Fuck Express and Javascript
This commit is contained in:
parent
03736e01e5
commit
f0a780f23f
1 changed files with 13 additions and 8 deletions
21
index.js
21
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}`)
|
||||
})
|
||||
const port = process.env.PORT || 3000;
|
||||
app.listen(port);
|
||||
|
||||
console.log('App is listening on port ' + port);
|
||||
Loading…
Reference in a new issue