feat: Initialize Turtle Control Center with React and WebSocket server
- Added index.html for the main entry point of the client application. - Created package.json for client dependencies and scripts. - Implemented App component with view controls and layout. - Added CSS styles for the application and components. - Developed ControlPanel component for turtle management and commands. - Created Map3D component for 3D visualization of turtles. - Established Zustand store for state management of turtles and WebSocket connection. - Set up server with Express and WebSocket for handling turtle updates and commands. - Added REST API endpoints for turtle status updates and command handling. - Implemented start.sh script for setting up and running the application.
This commit is contained in:
70
start.sh
Normal file
70
start.sh
Normal file
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "🐢 Turtle Control Center - Setup & Start"
|
||||
echo "========================================"
|
||||
echo ""
|
||||
|
||||
# Check if Node.js is installed
|
||||
if ! command -v node &> /dev/null; then
|
||||
echo "❌ Node.js is not installed. Please install Node.js 18+ first."
|
||||
echo " Visit: https://nodejs.org/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Node.js version: $(node --version)"
|
||||
echo ""
|
||||
|
||||
# Install server dependencies
|
||||
echo "📦 Installing server dependencies..."
|
||||
cd server
|
||||
if [ ! -d "node_modules" ]; then
|
||||
npm install
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Failed to install server dependencies"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo " ℹ️ Dependencies already installed (skipping)"
|
||||
fi
|
||||
cd ..
|
||||
|
||||
# Install client dependencies
|
||||
echo "📦 Installing client dependencies..."
|
||||
cd client
|
||||
if [ ! -d "node_modules" ]; then
|
||||
npm install
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Failed to install client dependencies"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo " ℹ️ Dependencies already installed (skipping)"
|
||||
fi
|
||||
cd ..
|
||||
|
||||
echo ""
|
||||
echo "✨ Setup complete!"
|
||||
echo ""
|
||||
echo "🚀 Starting servers..."
|
||||
echo ""
|
||||
echo "Server will be available at:"
|
||||
echo " 🌐 Web Interface: http://localhost:3000"
|
||||
echo " 📡 API Server: http://localhost:3001"
|
||||
echo " 🔌 WebSocket: ws://localhost:3002"
|
||||
echo ""
|
||||
echo "Press Ctrl+C to stop all servers"
|
||||
echo ""
|
||||
|
||||
# Start both server and client
|
||||
trap 'kill 0' SIGINT
|
||||
|
||||
cd server
|
||||
npm start &
|
||||
SERVER_PID=$!
|
||||
|
||||
cd ../client
|
||||
npm run dev &
|
||||
CLIENT_PID=$!
|
||||
|
||||
# Wait for both processes
|
||||
wait $SERVER_PID $CLIENT_PID
|
||||
Reference in New Issue
Block a user