-
Notifications
You must be signed in to change notification settings - Fork 2
/
app-prod.js
47 lines (40 loc) · 936 Bytes
/
app-prod.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
/**
* Created by YouHan on 2016/8/3.
*/
var express = require('express');
var app = express();
var rally = require('./app/server/rally');
var http = require('http');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var compression = require('compression');
var helmet = require('helmet');
//use gzip compression--生产环境中应放置在反向代理环节
app.use(compression());
app.use(helmet());
/**
* body parser
*/
/**
* change the max request limit
*/
app.use(bodyParser.json({
limit: '50mb'
})); // for parsing application/json
app.use(bodyParser.urlencoded({
extended: true,
limit: '50mb'
})); // for parsing application/x-www-form-urlencoded
/**
* cookie parser
*/
app.use(cookieParser());
/**
* static files
*/
app.use(express.static(__dirname + '/app/client'));
/**
* dispatch route
*/
app.use('/', rally);
http.createServer(app).listen(9999, "0.0.0.0");