-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
30 lines (26 loc) · 904 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
var express = require('express'),
path = require('path'),
favicon = require('serve-favicon'),
logger = require('morgan'),
cookieParser = require('cookie-parser'),
bodyParser = require('body-parser'),
core = require('core'),
routes = require('./routes'),
app = express(),
flow = core.flow,
__dirname = __dirname;
// 模板
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
// 中间件捆绑
app.use(flow.restype());
app.use(flow.link());
app.use(favicon(__dirname + '/public/favicon.ico'));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use(flow.res(app));
routes(app);
module.exports = app;