-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.js
46 lines (40 loc) · 1.25 KB
/
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
38
39
40
41
42
43
44
45
46
/**
* Module dependencies.
*/
var express = require('express'),
app = express(),
http = require('http'),
server = http.createServer(app),
socket = require('./models/socket'),
path = require('path'),
router = require('./routes'),
mongoStore = require('./node_modules/connect-mongo')(express),
config = require('./config');
app.configure(function(){
app.set('port', process.env.PORT || config.port);
app.set('view engine', config.viewEngine);
app.set('views', config.viewsDir);
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.compress());
app.use(express.bodyParser({
uploadDir: './public/KE/attached' //富文本上传目录
}));
app.use(express.methodOverride());
app.use(express.static(path.join(__dirname, config.staticPath)));
app.use(express.cookieParser());
app.use(express.session({
secret: config.dbSettings.cookieSecret,
cookie: config.dbSettings.cookieExpires,
store: new mongoStore({db: config.dbSettings.db})
}));
app.use(app.router);
});
app.configure('development', function(){
app.use(express.errorHandler());
});
router(app);
socket.socketStart(server);
server.listen(app.get('port'), function(){
console.log("Express server listening on port " + app.get('port'));
});