-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-web.bat
More file actions
37 lines (30 loc) · 888 Bytes
/
start-web.bat
File metadata and controls
37 lines (30 loc) · 888 Bytes
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
@echo off
setlocal
cd /d "%~dp0"
if not exist tmp mkdir tmp
echo [1/4] Building web server...
go build -o tmp\web.exe .\cmd\web
if errorlevel 1 (
echo Build failed. Server not started.
exit /b 1
)
echo [2/4] Stopping existing server on port 3000 (if running)...
for /f "tokens=5" %%p in ('netstat -ano ^| findstr ":3000" ^| findstr "LISTENING"') do (
taskkill /PID %%p /F >nul 2>nul
)
echo [3/4] Starting web server...
start "GitForge Web" /D "%~dp0" cmd /c "tmp\web.exe 1>tmp\\web.out.log 2>tmp\\web.err.log"
echo [4/4] Verifying startup...
set "STARTED="
for /l %%i in (1,1,20) do (
for /f "tokens=5" %%p in ('netstat -ano ^| findstr ":3000" ^| findstr "LISTENING"') do (
set "STARTED=1"
)
if defined STARTED goto :ok
timeout /t 1 >nul
)
echo Server failed to start. Check tmp\web.err.log
exit /b 1
:ok
echo Server started. Open http://localhost:3000
exit /b 0