react-test / server.js
hoduy99's picture
changing dist to build in server.js
b1e7726
raw
history blame contribute delete
477 Bytes
const express = require('express');
const path = require('path');
const app = express();
// Serve static files from the React app build directory
app.use(express.static(path.join(__dirname, 'build')));
// Handles any requests that don't match the ones above
app.get('*', (req, res) =>{
res.sendFile(path.join(__dirname, 'build', 'index.html'));
});
const port = process.env.PORT || 7860;
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});