-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-game.sh
More file actions
executable file
·50 lines (42 loc) · 1.2 KB
/
start-game.sh
File metadata and controls
executable file
·50 lines (42 loc) · 1.2 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
#!/bin/bash
echo "🚀 STARTING QUOTA QUEST 🚀"
echo ""
# Check if .env exists
if [ ! -f "server/.env" ]; then
echo "⚠️ No .env file found!"
echo "Creating .env from .env.example..."
cp server/.env.example server/.env
echo ""
echo "⚠️ IMPORTANT: Edit server/.env and add your OPENAI_API_KEY"
echo "Get your API key from: https://platform.openai.com/api-keys"
echo ""
read -p "Press Enter after you've added your API key to continue..."
fi
# Check if node_modules exists
if [ ! -d "server/node_modules" ]; then
echo "📦 Installing dependencies..."
cd server && npm install && cd ..
echo ""
fi
echo "🖥️ Starting server on http://localhost:3000..."
cd server && node server.js &
SERVER_PID=$!
cd ..
sleep 2
echo ""
echo "🎮 Opening game in browser..."
echo "Game URL: http://localhost:3000"
echo ""
echo "Press Ctrl+C to stop the server"
echo ""
# Open browser
if command -v open &> /dev/null; then
open "http://localhost:3000"
elif command -v xdg-open &> /dev/null; then
xdg-open "http://localhost:3000"
elif command -v start &> /dev/null; then
start "http://localhost:3000"
fi
# Wait for Ctrl+C
trap "kill $SERVER_PID; exit" INT
wait $SERVER_PID