17 lines
456 B
JavaScript
17 lines
456 B
JavaScript
const express = require('express');
|
|
const path = require('path');
|
|
const app = express();
|
|
const port = process.env.PORT || 3169;
|
|
|
|
// Serve static files from the React build
|
|
app.use(express.static(path.join(__dirname, '.')));
|
|
|
|
// Catch all routes and redirect to the index.html
|
|
app.get('*', (req, res) => {
|
|
res.sendFile(path.join(__dirname, 'index.html'));
|
|
});
|
|
|
|
// Start server
|
|
app.listen(port, () => {
|
|
console.log(`Server running on port ${port}`);
|
|
});
|