Showing
5 changed files
with
0 additions
and
73 deletions
apps/channel/controllers/index.js
deleted
100644 → 0
1 | -/** | ||
2 | - * channel controller | ||
3 | - * @author: yyq<yanqing.yang@yoho.cn> | ||
4 | - * @date: 2016/06/29 | ||
5 | - */ | ||
6 | - | ||
7 | -'use strict'; | ||
8 | - | ||
9 | -// const _ = require('lodash'); | ||
10 | -const headerModel = require('../../../doraemon/models/header'); | ||
11 | - | ||
12 | -let index = (req, res, next) => { | ||
13 | - headerModel.requestHeaderData('boys').then(result => { | ||
14 | - res.render('channel', result); | ||
15 | - }).catch(next); | ||
16 | -}; | ||
17 | - | ||
18 | -module.exports = { | ||
19 | - index | ||
20 | -}; |
apps/channel/index.js
deleted
100644 → 0
1 | -/** | ||
2 | - * sub app channel | ||
3 | - * @author: yyq<yanqing.yang@yoho.cn> | ||
4 | - * @date: 2016/06/29 | ||
5 | - */ | ||
6 | - | ||
7 | -var express = require('express'), | ||
8 | - path = require('path'), | ||
9 | - hbs = require('express-handlebars'); | ||
10 | - | ||
11 | -var app = express(); | ||
12 | - | ||
13 | -// set view engin | ||
14 | -var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root | ||
15 | - | ||
16 | -app.on('mount', function(parent) { | ||
17 | - delete parent.locals.settings; // 不继承父 App 的设置 | ||
18 | - Object.assign(app.locals, parent.locals); | ||
19 | -}); | ||
20 | - | ||
21 | -app.set('views', path.join(__dirname, 'views/action')); | ||
22 | -app.engine('.hbs', hbs({ | ||
23 | - extname: '.hbs', | ||
24 | - defaultLayout: 'layout', | ||
25 | - layoutsDir: doraemon, | ||
26 | - partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], | ||
27 | - helpers: 'helpers' | ||
28 | -})); | ||
29 | - | ||
30 | -// router | ||
31 | -app.use(require('./router')); | ||
32 | - | ||
33 | -module.exports = app; |
apps/channel/router.js
deleted
100644 → 0
1 | -/** | ||
2 | - * router of sub app channel | ||
3 | - * @author: yyq<yanqing.yang@yoho.cn> | ||
4 | - * @date: 2016/06/29 | ||
5 | - */ | ||
6 | - | ||
7 | -'use strict'; | ||
8 | - | ||
9 | -const router = require('express').Router(); // eslint-disable-line | ||
10 | -const cRoot = './controllers'; | ||
11 | - | ||
12 | -// Your controller here | ||
13 | -const channelController = require(`${cRoot}/index`); | ||
14 | - | ||
15 | -// 频道页路由 | ||
16 | -router.get('/', channelController.index); | ||
17 | - | ||
18 | - | ||
19 | -module.exports = router; |
-
Please register or login to post a comment