添加了Windows的start.bat和Linux/macOS的start.sh一键启动脚本,补充了完整的项目README文档,同时修复了前端类型文件的导入路径问题
63 lines
1.7 KiB
Batchfile
63 lines
1.7 KiB
Batchfile
@echo off
|
|
title jiang13-bbs launcher
|
|
|
|
echo ============================================
|
|
echo jiang13-bbs Dev Launcher
|
|
echo ============================================
|
|
echo.
|
|
|
|
REM ---- 1. Start PostgreSQL ----
|
|
echo [1/3] Starting database (Docker Compose)...
|
|
docker compose up -d postgres
|
|
if errorlevel 1 (
|
|
echo [FAIL] Database failed to start. Is Docker running?
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo [OK] Database started
|
|
echo.
|
|
|
|
REM ---- 2. Backend ----
|
|
echo [2/3] Checking backend config...
|
|
if not exist "backend\app.ini" (
|
|
copy "backend\app.ini.example" "backend\app.ini" >nul
|
|
echo Created backend\app.ini from template
|
|
)
|
|
if not exist "backend\data" mkdir "backend\data"
|
|
|
|
echo Starting backend (port 3001)...
|
|
start "jiang13-backend" cmd /k "cd /d %~dp0backend && go run ./cmd/jiang13"
|
|
echo [OK] Backend started
|
|
echo.
|
|
|
|
REM ---- 3. Frontend ----
|
|
echo [3/3] Checking frontend config...
|
|
if not exist "frontend\.env.local" (
|
|
copy "frontend\.env.example" "frontend\.env.local" >nul
|
|
echo Created frontend\.env.local from template
|
|
)
|
|
|
|
if not exist "frontend\node_modules" (
|
|
echo First run, installing dependencies...
|
|
cd /d %~dp0frontend
|
|
call npm install
|
|
cd /d %~dp0
|
|
)
|
|
|
|
echo Starting frontend (port 3000)...
|
|
start "jiang13-frontend" cmd /k "cd /d %~dp0frontend && npm run dev"
|
|
echo [OK] Frontend started
|
|
echo.
|
|
|
|
echo ============================================
|
|
echo All services started!
|
|
echo.
|
|
echo Frontend: http://localhost:3000
|
|
echo Backend: http://localhost:3001
|
|
echo Database: localhost:5432
|
|
echo.
|
|
echo Close each window to stop the service.
|
|
echo Stop database: docker compose down
|
|
echo ============================================
|
|
pause
|