mirror of
https://github.com/ANL-CEEESA/UnitCommitment.jl.git
synced 2025-12-06 00:08:52 -06:00
27 lines
692 B
JavaScript
27 lines
692 B
JavaScript
const express = require('express');
|
|
const path = require('path');
|
|
|
|
const app = express();
|
|
const PORT = process.env.PORT || 3000;
|
|
|
|
// Serve static files from the build directory
|
|
app.use(express.static(path.join(__dirname, 'build')));
|
|
|
|
// Handle client-side routing - serve index.html for all routes
|
|
app.get('/*splat', (req, res) => {
|
|
res.sendFile(path.join(__dirname, 'build', 'index.html'));
|
|
});
|
|
|
|
const server = app.listen(PORT, () => {
|
|
console.log(`Server is running on port ${PORT}`);
|
|
});
|
|
|
|
// Graceful shutdown on CTRL+C
|
|
process.on('SIGINT', () => {
|
|
console.log('\nShutting down gracefully...');
|
|
server.close(() => {
|
|
console.log('Server closed');
|
|
process.exit(0);
|
|
});
|
|
});
|