-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-server.js
More file actions
44 lines (34 loc) · 1.02 KB
/
deploy-server.js
File metadata and controls
44 lines (34 loc) · 1.02 KB
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
35
36
37
38
39
40
41
42
43
44
/*
* @Description:
* @Author: jiannan.lv
* @Date: 2019-10-15 09:01:30
* @LastEditTime: 2019-10-15 09:09:03
* @LastEditors: jiannan.lv
*/
// const configs = require('./build/config/product.config');
const path = require('path');
const express = require('express');
// const proxy = require('http-proxy-middleware');
const compression = require('compression');
const app = express();
// gzip
app.use(compression());
// server static resource
app.use(
express.static(path.join(__dirname, 'server'), {
maxAge: 30 * 24 * 60 * 60 * 1000,
setHeaders: (res, path, stat) => {
res.set('Access-Control-Allow-Origin', '*');
}
})
);
// Unmatched static resource, redirect to index.html -> router
app.use('*', (req, res) => res.sendFile(path.join(__dirname, 'server', 'data', 'index.html')));
// compiler
app.listen(3013, function(err) {
if(err) {
console.log(err);
return;
}
console.log(`--====> 💻 start data Listening at Open http://localhost:3013 <====----`);
});