-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-server.js
48 lines (37 loc) · 1.08 KB
/
deploy-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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* @Author: zhangb
* @Date: 2019-07-09 10:46:00
* @Email: [email protected]
* @Last Modified by: zhangb
* @Last Modified time: 2019-12-12 10:54:59
* @Description:
*/
// 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', 'dashboard', 'index.html')));
// compiler
app.listen(3034, function(err) {
if(err) {
console.log(err);
return;
}
console.log(
'--====> 💻 start data Listening at Open http://localhost:3034 <====----'
);
});