From f0a780f23f638af14f55c9f495ef7cd8484b497e Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Fri, 18 Sep 2020 05:43:09 -0700 Subject: [PATCH] Fuck Express and Javascript --- index.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) 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