hoduy99/react-test
0
1const express = require('express');2const path = require('path');3const app = express();4 5// Serve static files from the React app build directory6app.use(express.static(path.join(__dirname, 'build')));7 8// Handles any requests that don't match the ones above9app.get('*', (req, res) =>{10 res.sendFile(path.join(__dirname, 'build', 'index.html'));11});12 13const port = process.env.PORT || 7860;14app.listen(port, () => {15 console.log(`Server is running on port ${port}`);16});