diff --git a/index.js b/index.js index 268ba751..10de34d8 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,17 @@ -const express = require('express') -const path = require('path') +const express = require('express'); +const path = require('path'); -const app = express() +const app = express(); -const port = process.env.PORT || 3000 +// Serve the static files from the React app +app.use(express.static(path.join(__dirname, 'dist'))); -app.use(express.static(path.join(__dirname, 'dist'))) +// Handles any requests that don't match the ones above +app.get('*', (req, res) =>{ + res.sendFile(path.join(__dirname+'/dist/index.html')); +}); -app.listen(port, () => { - console.log(`App listening on port ${port}`) -}) \ No newline at end of file +const port = process.env.PORT || 3000; +app.listen(port); + +console.log('App is listening on port ' + port); \ No newline at end of file