-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·94 lines (79 loc) · 2.23 KB
/
start.sh
File metadata and controls
executable file
·94 lines (79 loc) · 2.23 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
# Content Extractor Pro
# Startup Script
echo "⚡ Content Extractor Pro"
echo "=================================================="
echo ""
# Check if Python is available
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is required but not installed."
exit 1
fi
# Install Python dependencies if requirements.txt exists
if [ -f "config/requirements.txt" ]; then
echo "📦 Installing Python dependencies..."
pip install -r config/requirements.txt
echo ""
fi
echo "🚀 Starting servers..."
echo ""
# --- React App (preferred) ---
if command -v node &> /dev/null && [ -d "app" ]; then
echo "▶️ Starting React App (Port 5173)..."
cd app
# Install npm deps if not present
if [ ! -d "node_modules" ]; then
echo " Installing npm dependencies..."
npm install
fi
# Build and preview (production), or dev server
if [ "$1" = "--dev" ]; then
npm run dev -- --host 0.0.0.0 &
else
npm run build && npm run preview -- --port 5173 --host 0.0.0.0 &
fi
FRONTEND_PID=$!
cd ..
REACT_PORT=5173
else
# Fallback: serve old vanilla HTML frontend
echo "▶️ Starting Legacy Frontend (Port 8000)..."
cd frontend
python3 -m http.server 8000 &
FRONTEND_PID=$!
cd ..
REACT_PORT=8000
fi
sleep 2
# Start backend server
echo "▶️ Starting Backend Server (Port 5002)..."
cd backend
python3 app.py &
BACKEND_PID=$!
cd ..
sleep 3
echo ""
echo "✅ Servers are running!"
echo "=================================================="
echo "🌐 React App: http://localhost:${REACT_PORT}"
echo "🎬 Legacy Frontend: http://localhost:8000/index.html"
echo "🔧 Backend API: http://localhost:5002"
echo ""
echo "=================================================="
echo "💡 Tips:"
echo " • Run './start.sh --dev' for hot-reload dev mode"
echo " • Use Ctrl+C to stop all servers"
echo ""
# Function to cleanup processes on script exit
cleanup() {
echo ""
echo "🛑 Stopping servers..."
kill $FRONTEND_PID 2>/dev/null
kill $BACKEND_PID 2>/dev/null
echo "✅ Servers stopped."
exit 0
}
# Set trap to cleanup on script exit
trap cleanup EXIT INT TERM
# Wait for processes to finish
wait