Fuck Express and Javascript

This commit is contained in:
Justin Edmund 2020-09-18 05:43:09 -07:00
parent 03736e01e5
commit f0a780f23f

View file

@ -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}`)
})
const port = process.env.PORT || 3000;
app.listen(port);
console.log('App is listening on port ' + port);