forked from colorpeach/colorbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
37 lines (31 loc) · 993 Bytes
/
app.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
var path = require('path');
var express = require("express");
var app = express();
var staticPath = path.join(__dirname, '/web/dev');
process.env.staticPath = staticPath;
app.set("views", staticPath);
app.set("view engine", "jade");
//压缩
app.use(require('compression')({
threshold: 512
}));
//报文实体解析
app.use(require('body-parser')());
//favicon图标
// app.use(require('serve-favicon')(__dirname + 'client/favicon.ico'));
//重写http方法,在客户端不支持put或者delete等方法时也能继续使用
app.use(require("method-override")());
//cookie解析
app.use(require("cookie-parser")());
app.use(require("express-session")({
secret: 'colorbox',
name: 'sid',
cookie: { maxAge: 86400000 }
}));
//静态文件路径
app.use(require("serve-static")(staticPath));
app.listen(process.env.PORT || process.env.VMC_APP_PORT || 3000, function () {
console.log('running colorbox');
});
require("./route/route.js")(app);
require("./config/task.js");