-
Notifications
You must be signed in to change notification settings - Fork 4
/
server.js
29 lines (22 loc) · 660 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const cors = require('cors');
const app = express();
const port = process.env.PORT || 9000;
app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static(path.join(__dirname, 'build')));
app.get('/*', function(req, res) {
var options = {
root: 'build',
headers: {
"/**": {
"Cache-Control": "no-store, no-cache"
}
}
}
res.sendFile(path.join(__dirname, options, 'index.html'));
});
app.listen(port, () => console.log(`Listening on port ${port}`));