Blame view

apps/home/index.js 828 Bytes
weiqingting authored
1
/**
王水玲 authored
2 3 4
 * sub app home
 * @author: Bi Kai<kai.bi@yoho.cn>
 * @date: 2016/05/09
weiqingting authored
5 6 7
 */

var express = require('express'),
陈峰 authored
8 9
    path = require('path'),
    hbsEvent = require('../../config/hbsevent');
weiqingting authored
10 11 12 13 14 15 16 17 18 19

var app = express();

// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root

app.on('mount', function(parent) {
    delete parent.locals.settings; // 不继承父 App 的设置
    Object.assign(app.locals, parent.locals);
});
王水玲 authored
20
毕凯 authored
21 22
app.disable('x-powered-by');
姜枫 authored
23
app.use(global.yoho.hbs({
weiqingting authored
24 25 26
    extname: '.hbs',
    defaultLayout: 'layout',
    layoutsDir: doraemon,
姜枫 authored
27 28
    partialsDir: path.join(__dirname, './views/partial'),
    views: path.join(__dirname, 'views/action'),
陈峰 authored
29 30
    helpers: global.yoho.helpers,
    cb: hbsEvent.cb
weiqingting authored
31 32 33 34 35 36
}));

// router
app.use(require('./router'));

module.exports = app;