...
|
...
|
@@ -32,6 +32,9 @@ global.library = path.resolve('./library'); |
|
|
global.middleware = path.resolve('./doraemon/middleware');
|
|
|
global.utils = path.resolve('./utils');
|
|
|
|
|
|
// logger
|
|
|
const logger = require(global.library + '/logger');
|
|
|
|
|
|
// 向模板注入变量
|
|
|
app.locals.devEnv = app.get('env') === 'development';
|
|
|
app.locals.version = pkg.version;
|
...
|
...
|
@@ -80,7 +83,11 @@ app.use((req, res, next) => { |
|
|
app.use(seo());
|
|
|
|
|
|
// dispatcher
|
|
|
require('./dispatch')(app);
|
|
|
try {
|
|
|
require('./dispatch')(app);
|
|
|
} catch (e) {
|
|
|
logger.error(e);
|
|
|
}
|
|
|
|
|
|
// listener
|
|
|
app.listen(config.port, function() {
|
...
|
...
|
|