Blame view

apps/brands/index.js 772 Bytes
hongweigao authored
1 2 3 4 5 6 7
/**
 * router of sub app brands
 * @author: ghw<hongwei.gao@yoho.cn>
 * @date: 2016/09/29
 */

var express = require('express'),
周少峰 authored
8
    path = require('path');
hongweigao authored
9 10 11 12 13 14

var app = express();

// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
周少峰 authored
15 16
app.disable('x-powered-by');
hongweigao authored
17 18 19 20 21
app.on('mount', function(parent) {
    delete parent.locals.settings; // 不继承父 App 的设置
    Object.assign(app.locals, parent.locals);
});
周少峰 authored
22
app.use(global.yoho.hbs({
hongweigao authored
23 24 25
    extname: '.hbs',
    defaultLayout: 'layout',
    layoutsDir: doraemon,
周少峰 authored
26 27
    partialsDir: [path.join(__dirname, 'views/partial')],
    views: path.join(__dirname, 'views/action'),
hongweigao authored
28 29 30 31 32 33 34
    helpers: global.yoho.helpers
}));

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

module.exports = app;