footprint/start.bat

67 lines
1.4 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
echo 📍 Footprint - 打卡定位系统 - 启动脚本
echo.
REM 检查 Node.js
where node >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
echo ❌ 未检测到 Node.js请先安装 Node.js 18+
pause
exit /b 1
)
echo ✅ Node.js 已安装
echo.
REM 安装后端依赖
if not exist "backend\node_modules" (
echo 📦 安装后端依赖...
cd backend
call npm install
cd ..
)
REM 安装前端依赖
if not exist "frontend\node_modules" (
echo 📦 安装前端依赖...
cd frontend
call npm install
cd ..
)
REM 检查环境变量
if not exist "backend\.env" (
echo ⚠️ 未检测到 .env 文件,从模板创建...
copy backend\.env.example backend\.env
echo 📝 请编辑 backend\.env 文件,配置 OAuth2 凭据
echo.
)
REM 初始化数据库
echo 🗄️ 初始化数据库...
cd backend
call npm run init-db
cd ..
echo.
REM 启动服务
echo 🚀 启动服务...
echo.
echo ▶️ 启动后端服务 (http://localhost:5000)...
start "Footprint Backend" cmd /k "cd backend && npm run dev"
timeout /t 3 /nobreak >nul
echo ▶️ 启动前端服务 (http://localhost:3000)...
start "Footprint Frontend" cmd /k "cd frontend && npm start"
echo.
echo ✅ 服务已启动!
echo.
echo 访问地址:
echo - 前端: http://localhost:3000
echo - 后端: http://localhost:5000
echo.
echo 关闭窗口即可停止服务
pause