-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-server.sh
More file actions
36 lines (32 loc) · 1.02 KB
/
start-server.sh
File metadata and controls
36 lines (32 loc) · 1.02 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
#!/bin/bash
echo "============================================"
echo " Local Server - Enhanced Version"
echo "============================================"
echo ""
# Check if Node.js is available
if command -v node &> /dev/null; then
echo "[OK] Node.js found"
echo ""
# Check if dependencies are installed
if [ ! -d "node_modules" ]; then
echo "[INFO] Installing dependencies..."
npm install
echo ""
fi
echo "Starting server..."
echo ""
node server.js "$@"
# Check if Python is available (fallback)
elif command -v python3 &> /dev/null; then
echo "[OK] Python found - starting simple server..."
python3 -m http.server 8000
elif command -v python &> /dev/null; then
echo "[OK] Python found - starting simple server..."
python -m http.server 8000
else
echo "[ERROR] No server found!"
echo "Please install Node.js (recommended) or Python"
echo "Node.js: https://nodejs.org/"
echo "Python: https://www.python.org/downloads/"
exit 1
fi