-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.sh
More file actions
42 lines (33 loc) · 901 Bytes
/
Copy pathrun.sh
File metadata and controls
42 lines (33 loc) · 901 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
#!/usr/bin/env bash
set -e
echo "Starting WebSentry..."
echo
# Start Python API backend in background
echo "[1/2] Starting scanner.py API on port 8081..."
if command -v python3 >/dev/null 2>&1; then
PYTHON_CMD="python3"
elif command -v python >/dev/null 2>&1; then
PYTHON_CMD="python"
else
echo "Error: Python is not installed or not in PATH."
exit 1
fi
$PYTHON_CMD scanner.py &
BACKEND_PID=$!
# Small delay to let the backend start
sleep 2
# Start React frontend dev server
echo "[2/2] Starting React frontend dev server..."
cd frontend
npm run dev &
FRONTEND_PID=$!
echo
echo "WebSentry is running!"
echo " API: http://localhost:8081/scan"
echo " Frontend: http://localhost:5173"
echo
echo "Press Ctrl+C to stop both servers."
# Wait for either process to exit
wait $BACKEND_PID $FRONTEND_PID
# Cleanup on exit
trap "kill $BACKEND_PID $FRONTEND_PID 2>/dev/null" EXIT