-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.sh
More file actions
53 lines (44 loc) · 1.06 KB
/
start.sh
File metadata and controls
53 lines (44 loc) · 1.06 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
#!/bin/bash
# GitHub Copilot CLI AI助手 启动脚本
echo "=========================================="
echo " GitHub Copilot CLI AI助手"
echo "=========================================="
# 检查 Node.js
if ! command -v node &> /dev/null; then
echo "错误: 未找到 Node.js,请先安装 Node.js v18+"
exit 1
fi
# 启动后端
echo ""
echo "[1/2] 启动后端服务..."
cd backend
if [ ! -d "node_modules" ]; then
echo "安装后端依赖..."
npm install
fi
npm run dev &
BACKEND_PID=$!
cd ..
# 等待后端启动
sleep 3
# 启动前端
echo ""
echo "[2/2] 启动前端服务..."
cd frontend
if [ ! -d "node_modules" ]; then
echo "安装前端依赖..."
npm install
fi
npm run dev &
FRONTEND_PID=$!
cd ..
echo ""
echo "=========================================="
echo " 服务已启动!"
echo " 前端: http://localhost:3000"
echo " 后端: http://localhost:3001"
echo " 按 Ctrl+C 停止所有服务"
echo "=========================================="
# 等待中断信号
trap "kill $BACKEND_PID $FRONTEND_PID 2>/dev/null; exit" INT TERM
wait