-
Notifications
You must be signed in to change notification settings - Fork 6
/
server.js
34 lines (24 loc) · 798 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
30
31
32
33
34
const express = require('express');
const path = require('path');
const app = express();
const PORT = 3000;
// const HOST = process.env.API_BASE_URL || 'https://interview-api.elk-tree.site';
// console.log('Start proxy url in', process.env.API_BASE_URL);
const TIME_OUT = 30 * 1e3;
// app.use(timeout(TIME_OUT));
/*app.use((req, res, next) => {
if (!req.timedout) next();
});*/
const options = {
headers: {
'strict-transport-security': 'max-age=31536000'
}
}
app.use(express.static(path.join(__dirname, './build')));
// app.use('/api', createProxyMiddleware({ target: HOST, changeOrigin: true }));
app.get('/*', function (req, res) {
res.sendFile(path.join(__dirname, './build', 'index.html'), options);
});
app.listen(PORT, function(){
console.log(`Start in ${PORT}`);
});