const express = require('express');
const cors = require('cors');
const path = require('path');

const app = express();
const PORT = process.env.PORT || 3000;

app.use(cors());
app.use(express.json());

// Serve the calculation engine located at the root
app.use('/pkCore.js', express.static(path.join(__dirname, '../pkCore.js')));

// Serve frontend static files
app.use(express.static(path.join(__dirname, '../frontend')));

app.listen(PORT, () => {
  console.log(`Serveur KétaPK démarré sur http://localhost:${PORT}`);
});