@echo off chcp 65001 > nul cd /d "%~dp0" echo ================================ echo EENE Dashboard - Server Start echo ================================ echo. :: 0. 기존 서버 종료 (title 설정 전에 실행 — 자기 자신 종료 방지) echo [1/4] Stopping old servers... taskkill /fi "WindowTitle eq EENE Dashboard - Running*" /f > nul 2>&1 powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-NetTCPConnection -State Listen -ErrorAction SilentlyContinue | Where-Object { @(4000,3000,3001) -contains $_.LocalPort } | ForEach-Object { Stop-Process -Id $_.OwningProcess -Force -ErrorAction SilentlyContinue }" > nul 2>&1 timeout /t 2 /nobreak > nul echo Done. echo. title EENE Dashboard - Running :: 1. PostgreSQL 서비스 확인 echo [2/4] Checking Database... sc query postgresql-x64-16 | find "RUNNING" > nul 2>&1 if %errorlevel% neq 0 ( echo Starting PostgreSQL service... net start postgresql-x64-16 ) echo Database is ready. echo. :: 2. DB 마이그레이션 + Prisma 클라이언트 갱신 echo [3/4] DB migrate + Prisma generate... cd /d "%~dp0backend" call npx prisma migrate deploy if errorlevel 1 ( echo Migration failed. backend\.env DATABASE_URL 확인 pause exit /b 1 ) call npx prisma generate if errorlevel 1 ( echo Prisma generate failed. 다른 터미널/서버가 켜져 있으면 종료 후 다시 시도하세요. pause exit /b 1 ) cd /d "%~dp0" echo Done. echo. :: 3. 백엔드 + 프론트엔드 echo [4/4] Starting Backend + Frontend... echo. echo Dashboard : http://localhost:3000 echo Detail : http://localhost:3000/detail echo Team : http://172.16.8.248:3000 echo. echo 종료: Ctrl+C echo ================================ echo. npx --yes concurrently -k -n "API,WEB" -c "cyan,green" "cd /d %~dp0backend && npm run dev" "cd /d %~dp0frontend && npm run dev" echo. echo Server stopped. pause