-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart_local.sh
executable file
·49 lines (40 loc) · 999 Bytes
/
start_local.sh
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
#!/bin/bash
# Script to start both frontend and backend development servers
# Set environment to local
export APP_ENVIRONMENT=local
export DEBUG=true
# Load local environment variables if .env.local exists
if [ -f .env.local ]; then
echo "Loading environment variables from .env.local"
set -a
source .env.local
set +a
else
echo "Warning: .env.local not found, using default environment"
fi
# Start backend in background
echo "Starting backend server..."
cd backend
python -m uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 &
BACKEND_PID=$!
cd ..
# Give backend time to start
sleep 2
# Start frontend in foreground
echo "Starting frontend server..."
cd frontend
npm start &
FRONTEND_PID=$!
cd ..
# Function to handle exit
function cleanup {
echo "Shutting down servers..."
kill $BACKEND_PID
kill $FRONTEND_PID
exit 0
}
# Register cleanup function on SIGINT (Ctrl+C)
trap cleanup SIGINT
# Keep script running
echo "Servers are running. Press Ctrl+C to stop."
wait