-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·33 lines (25 loc) · 878 Bytes
/
Copy pathstart.sh
File metadata and controls
executable file
·33 lines (25 loc) · 878 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BACKEND_DIR="$ROOT_DIR/backend"
FRONTEND_DIR="$ROOT_DIR/frontend"
if [ ! -d "$BACKEND_DIR/.venv" ]; then
python3 -m venv "$BACKEND_DIR/.venv"
fi
source "$BACKEND_DIR/.venv/bin/activate"
pip install -r "$BACKEND_DIR/requirements.txt"
if [ ! -d "$FRONTEND_DIR/node_modules" ]; then
(cd "$FRONTEND_DIR" && npm install)
fi
cleanup() {
if [ -n "${BACKEND_PID:-}" ]; then kill "$BACKEND_PID" 2>/dev/null || true; fi
if [ -n "${FRONTEND_PID:-}" ]; then kill "$FRONTEND_PID" 2>/dev/null || true; fi
}
trap cleanup EXIT
(cd "$BACKEND_DIR" && uvicorn app.main:app --reload --host 127.0.0.1 --port 8000) &
BACKEND_PID=$!
(cd "$FRONTEND_DIR" && npm run dev -- --port 5173) &
FRONTEND_PID=$!
echo "Frontend: http://127.0.0.1:5173"
echo "Backend: http://127.0.0.1:8000/docs"
wait