#!/bin/bash
cd "$(dirname "$0")"

echo "[InfoGenie] 启动本地开发环境..."

# 启动后端
(cd InfoGenie-go-backend && APP_ENV=development go run ./cmd/server/) &
BACKEND_PID=$!

# 启动前端
(cd infogenie-frontend && npm start) &
FRONTEND_PID=$!

echo "  后端 PID: $BACKEND_PID -> http://localhost:5002"
echo "  前端 PID: $FRONTEND_PID -> http://localhost:3000"
echo "  按 Ctrl+C 停止所有服务"

trap "kill $BACKEND_PID $FRONTEND_PID 2>/dev/null; exit" SIGINT SIGTERM
wait
