#!/bin/bash
# Frontend Startup Script with Error Handling
# This prevents the frontend from being interrupted

echo "🚀 Starting Frontend Server..."
cd /media/pts/Website/PromptTech_Solution_Site/frontend

# Kill any existing processes on port 5300
echo "Checking for existing processes..."
lsof -ti:5300 | xargs kill -9 2>/dev/null || true
sleep 1

# Start the frontend
echo "Starting React development server on port 5300..."
PORT=5300 npm start

# If interrupted, this will clean up
trap 'echo "⚠️  Frontend stopped"; exit 0' INT TERM
