-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.bat
More file actions
116 lines (99 loc) · 2.31 KB
/
start.bat
File metadata and controls
116 lines (99 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
@echo off
chcp 850 >nul
title EdTech Mastery - Servidor LAN
cls
echo.
echo ====================================
echo EdTech Mastery - Inicio del Servidor
echo ====================================
echo.
cd /d "%~dp0"
echo [1/5] Verificando Node.js...
node --version >nul 2>&1
if errorlevel 1 (
echo ERROR: Node.js no esta instalado.
echo Descarga desde: https://nodejs.org
pause
exit
)
for /f "delims=" %%a in ('node --version') do echo OK: Node.js %%a
echo.
REM Detectar todas las direcciones IP
echo [2/5] Detectando direcciones IP...
echo.
echo Lista de direcciones IP disponibles:
echo.
set count=0
setlocal EnableDelayedExpansion
for /f "tokens=2 delims=:" %%a in ('ipconfig ^| findstr /c:"IPv4"') do (
set ip=%%a
set ip=!ip: =!
if not "!ip!"=="" (
if not "!ip!"==":" (
set /a count+=1
echo [!count!] !ip!
set ip!count!=!ip!
)
)
)
if !count! equ 0 (
echo ERROR: No se encontro ninguna direccion IP.
pause
exit
)
echo.
set /p selected="Selecciona el numero de la IP a usar [1-!count!]: "
if "!ip%selected%!"=="" (
echo ERROR: Seleccion invalida.
pause
exit
)
set "LOCAL_IP=!ip%selected%!"
set "LOCAL_IP=!LOCAL_IP: =!"
setx LOCAL_IP "%LOCAL_IP%"
echo.
echo OK: IP seleccionada: %LOCAL_IP%
echo.
REM Configurar variable de entorno para el servidor
setx SERVER_IP "%LOCAL_IP%" >nul
REM Verificar dependencias
echo [3/5] Verificando dependencias...
if not exist "node_modules" (
echo Instalando dependencias...
call npm install
if errorlevel 1 (
echo ERROR al instalar dependencias.
pause
exit
)
echo OK: Dependencias instaladas.
) else (
echo OK: Dependencias listas.
)
echo.
REM Mostrar informacion
echo [4/5] Servidor listo.
echo.
echo ====================================
echo SERVIDOR PREPARADO
echo ====================================
echo.
echo PARA ALUMNOS: http://%LOCAL_IP%:3000
echo PARA PROFESOR: http://%LOCAL_IP%:3000/admin
echo.
echo Los alumnos deben estar en la MISMA red WiFi.
echo.
pause
REM Iniciar servidor
echo [5/5] Iniciando servidor...
echo.
echo ====================================
echo EdTech Mastery CORRIENDO
echo ====================================
echo.
echo Presiona Ctrl+C para detener.
echo.
node server.js
echo.
echo El servidor se detuvo.
pause