-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·43 lines (35 loc) · 913 Bytes
/
start.sh
File metadata and controls
executable file
·43 lines (35 loc) · 913 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
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# Function to cleanup background processes on script termination
cleanup() {
echo "Shutting down servers..."
kill $(jobs -p) 2>/dev/null
exit
}
# Set up trap for cleanup on script termination
trap cleanup SIGINT SIGTERM
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "Error: Python 3 is not installed"
exit 1
fi
# Check if npm is installed
if ! command -v npm &> /dev/null; then
echo "Error: npm is not installed"
exit 1
fi
# Start the backend server
echo "Starting backend server..."
python3 -m uvicorn app:app --reload --port 8000 &
BACKEND_PID=$!
# Start the frontend development server
echo "Starting frontend server..."
cd frontend
if [ $? -ne 0 ]; then
echo "Error: Could not find frontend directory"
kill $BACKEND_PID
exit 1
fi
npm start &
FRONTEND_PID=$!
# Wait for both processes
wait $BACKEND_PID $FRONTEND_PID