Blame view

apps/channel/index.js 831 Bytes
biao authored
1 2 3 4 5 6 7
/**
 * sub app girls
 * @author: biao<bill.zhao@yoho.cn>
 * @date: 2016/05/16
 */

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

var app = express();

// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
周少峰 authored
16
app.disable('x-powered-by');
biao authored
17
biao authored
18 19 20 21 22
app.on('mount', function(parent) {
    delete parent.locals.settings; // 不继承父 App 的设置
    Object.assign(app.locals, parent.locals);
});
周少峰 authored
23
app.use(global.yoho.hbs({
biao 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
biao authored
31 32 33 34 35 36
}));

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

module.exports = app;
37