You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
836 B
48 lines
836 B
#!/bin/bash
|
|
|
|
echo "启动任务管理系统..."
|
|
|
|
# 检查是否安装了依赖
|
|
if [ ! -d "frontend/node_modules" ]; then
|
|
echo "安装前端依赖..."
|
|
cd frontend
|
|
npm install
|
|
cd ..
|
|
fi
|
|
|
|
if [ ! -f "backend/go.mod" ]; then
|
|
echo "初始化后端项目..."
|
|
cd backend
|
|
go mod init task-track-backend
|
|
go mod tidy
|
|
cd ..
|
|
fi
|
|
|
|
# 启动后端服务器
|
|
echo "启动后端服务器..."
|
|
cd backend
|
|
go run main.go &
|
|
BACKEND_PID=$!
|
|
cd ..
|
|
|
|
# 等待后端启动
|
|
sleep 3
|
|
|
|
# 启动前端服务器
|
|
echo "启动前端服务器..."
|
|
cd frontend
|
|
npm run dev &
|
|
FRONTEND_PID=$!
|
|
cd ..
|
|
|
|
echo "系统启动完成!"
|
|
echo "前端地址: http://localhost:5173"
|
|
echo "后端地址: http://localhost:8080"
|
|
echo ""
|
|
echo "按 Ctrl+C 停止服务器"
|
|
|
|
# 等待用户停止
|
|
wait
|
|
|
|
# 清理进程
|
|
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null
|
|
|