PortfolioSite/server.js

16 lines
479 B
JavaScript

const express = require('express');
const path = require('path');
const app = express();
const PORT = process.env.PORT || 3888;
// Serve static files from the React build
app.use(express.static(path.join(__dirname, 'build')));
// Serve index.html for all routes to support client-side routing
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, 'build', 'index.html'));
});
app.listen(PORT, '0.0.0.0', () => {
console.log(`Server running on port ${PORT}`);
});