Blame view

apps/cart/index.js 927 Bytes
htoooth authored
1 2 3 4 5 6 7 8 9
/**
 * sub app cart
 * @author: htoooth<ht.anglenx@gmail.com>
 * @date: 2016/10/19
 */

'use strict';

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

var app = express();

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

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

module.exports = app;