-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
41 lines (33 loc) · 983 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
35
36
37
38
39
40
41
//调用了哪些模块和文件
var express = require('express');
var app = express();
var path = require('path');
var c = require('./config/config');
var log = eval("c.config." + c.config.config + ".log");
var helloic = require('./controler/helloic');
//初始化定义
app.configure(function () {
app.set('views', __dirname + '/ejs_public');
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser('waterbear'));
app.use(express.session());
app.use(app.router);
app.use(express.errorHandler());
});
app.use(express.static(path.join(__dirname, 'public')));
//app.use(express.static(path.join(__dirname, 'manager')));
app.use(express.cookieParser('box'));
app.use(express.session({
cookie: {
maxAge: 2 * 60 * 1000
},
secret: "waterbearsecretkey"
}));
try {
helloic(app);
} catch (e) {
log.error(e);
}
app.listen(process.env.port || 18080);
console.log(process.env.port || 18080);