const express = require('express');
const path = require('path');
const app = express();
const PORT = 12005;

// Serve static files from the src directory
app.use(express.static(path.join(__dirname, 'src')));

// Serve the main app
app.get('/', (req, res) => {
  res.sendFile(path.join(__dirname, 'src', 'index.html'));
});

// Start the dev server
const server = app.listen(PORT, () => {
  console.log(`Frontend dev server running on http://localhost:${PORT}`);
});

// Keep the server running
process.on('SIGINT', () => {
  console.log('Shutting down dev server...');
  server.close(() => {
    process.exit(0);
  });
});

// Prevent the process from exiting
setInterval(() => {
  // Keep alive
}, 1000);