router.js
1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* router of sub app partial
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2016/06/30
*/
'use strict';
const auth = require(`${global.middleware}/auth`);
const router = require('express').Router(); // eslint-disable-line
const cRoot = './controllers';
const list = require(cRoot + '/list');
const item = require(cRoot + '/item');
const fav = require(cRoot + '/favorite');
const shop = require(cRoot + '/shop');
const query = require(cRoot + '/query');
const recommend = require(cRoot + '/recommend');
// Your controller here
router.get('/list', list.index); // 列表页面
router.get('/list/new', list.newPage); // 新品列表页
router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, item.index); // 商品详情routers
router.post('/item/togglecollect', auth, fav.product); // 商品详情页
router.get('/item/getProductInfo', item.getProductInfo); // 商品详情信息
router.get('/shop/query/all', shop.indexQuery);
router.get('/shop/:domain/list', shop.list);
router.get('/shop/:domain', shop.index);
router.post('/shop/togglecollect', auth, fav.shop);
router.post('/brand/togglecollect', auth, fav.brand);
router.get('/query', query.index);
router.get('/getRecommendProduct', recommend.getRecommendProduct);
module.exports = router;