immortal-bnb/start-backend.sh
2025-11-21 05:05:57 +03:00

31 lines
706 B
Bash
Executable File

#!/bin/bash
# Start Backend Server Script
# Clears ports and starts the backend cleanly
echo "๐Ÿ”ง Preparing to start backend server..."
# Kill any existing processes on port 3001
echo "Clearing port 3001..."
lsof -ti:3001 | xargs kill -9 2>/dev/null
pkill -f "bun.*index" 2>/dev/null
pkill -f "node.*index" 2>/dev/null
sleep 2
# Check if port is free
if lsof -ti:3001 >/dev/null 2>&1; then
echo "โŒ Port 3001 is still in use. Please manually kill the process."
exit 1
fi
echo "โœ… Port 3001 is free"
echo ""
echo "๐Ÿš€ Starting backend server..."
echo " Backend will run on: http://localhost:3001"
echo " WebSocket: ws://localhost:3001/ws"
echo ""
# Start the backend
bun run src/index.ts