Blame view

apps/guang/router.js 3.84 KB
ccbikai authored
1 2 3 4 5 6 7 8 9 10 11
/**
 * router of sub app channel
 * @author: Bi Kai<kai.bi@yoho.cn>
 * @date: 2016/05/09
 */

'use strict';

const express = require('express');
const cRoot = './controllers';
const star = require(cRoot + '/star');
lijing authored
12
const homeController = require(`${cRoot}/index`);
郝肖肖 authored
13
const plusstar = require(cRoot + '/plusstar');
14
const rewrite = require('../../doraemon/middleware/rewrite');
李靖 authored
15
const mip = require('../../doraemon/middleware/mip');
16
17 18
const index = require(cRoot + '/index');
const opt = require(cRoot + '/opt');
郭成尧 authored
19
const detail = require(cRoot + '/detail');
zhangxiaoru authored
20
const plustar = require(cRoot + '/plustar');
21
const rss = require(cRoot + '/rss');
zhangxiaoru authored
22
const brand = require(cRoot + '/brand-list');
周少峰 authored
23
const sitemap = require('../3party/controllers/sitemap');
ccbikai authored
24 25
const router = express.Router(); // eslint-disable-line
王水玲 authored
26
router.get('/star', star.index); // 星潮教室首页
ccbikai authored
27
router.get('/star/getIndexHtml', star.getIndexHtml); // 星潮教室首页
王水玲 authored
28
router.get('/star/detail', star.detail); // 明星文章专区
王水玲 authored
29
router.get('/star/detailList', star.detailList); // 明星文章专区文章Ajax请求
王水玲 authored
30 31 32
router.get('/star/special', star.special); // 星潮教室星专题
router.get('/star/collocation', star.collocation); // 星潮教室星搭配
router.get('/star/collocation/list', star.collocationList); // 星潮教室星搭配文章请求
ccbikai authored
33
ccbikai authored
34
router.post('/star/setFavorite', star.setFavorite); // 收藏文章
lijing authored
35
router.get('/', homeController.index); // 逛首页
陈峰 authored
36
// router.get(/^\/((boys)|(girls)|(kids)|(lifestyle)-[^\/]+)/, rewrite.resolve, homeController.index); // 逛首页 SEO优化
ccbikai authored
37
38
router.get('/plusstar', rewrite.channel, plusstar.indexRedirect); // 潮流优选
陈峰 authored
39
router.get(/^\/(.*?)-plusstar/, rewrite.resolve, plusstar.index); // 潮流优选 SEO优化
40
router.post('/plusstar/userSkn', plusstar.userSkn); // 用户推荐skn
郝肖肖 authored
41
router.get('/plusstar/resources-template', plusstar.resourcesTemplate); // 潮流优选首页-资源位
郝肖肖 authored
42
router.post('/plusstar/resources-goodsList', plusstar.resourcesGoodsList); // 潮流优选首页-资源位-商品列表
陈峰 authored
43
router.get('/', index.index); // 逛首页
lijing authored
44
router.get('/tags/index', index.tag); // 逛标签页
郝肖肖 authored
45
46
router.get('/author/index', rewrite.channel, index.editorRedirect); // 编辑简介
47
router.get(/^\/author-([^\/]+)/, rewrite.resolve, index.editor); // 编辑简介 SEO优化
48
49
router.get('/index/page', index.pageData); // 逛列表页面的资讯分页
50 51

router.post('/opt/praiseArticle', opt.praiseArticle); // 资讯文章点赞 (H5里显示点赞)
lijing authored
52
router.post('/opt/collectArticle', opt.collectArticle); // 资讯文章收藏 (H5里显示收藏)
zhangxiaoru authored
53
router.post('/opt/favoriteBrand', opt.favoriteBrand); // 品牌收藏
陈峰 authored
54
郭成尧 authored
55
router.get('/info/index', rewrite.channel, detail.indexRedirect); // 逛详情页
张孝茹 authored
56
router.get(/^\/info\/(.*?)\.html/, rewrite.resolve, mip, detail.indexRedirect); // 逛详情页 SEO优化
57
张孝茹 authored
58
router.get('/:id.html', mip, detail.index); // 逛详情页(兼容 PC 跳转过来的链接)
郭成尧 authored
59 60
router.get('/info/mini', detail.mini); // 逛mini内容页
router.get('/info/foryoho', detail.foryoho); // 逛foryoho内容页
陈峰 authored
61
郭成尧 authored
62 63
router.get('/info/getComments', detail.getComments); // 异步获取逛文章评论
zhangxiaoru authored
64 65
router.get('/plustar', plustar.getListData); // 国际优选列表页
router.get('/plustar/brandinfo', plustar.getDetailData); // 国际优选详情页
陈峰 authored
66
router.post('/plustar/brandinfoAsync', plustar.getDetailDataAsync); // 国际优选详情页异步数据
zhangxiaoru authored
67
陈峰 authored
68 69
router.get('/rss/new', (req, res, next) => rss.rss(req, res, next, '')); // 订阅资讯
router.get('/rss/new-gmt', (req, res, next) => rss.rss(req, res, next, 'gmt')); // 订阅资讯
70
router.get(/^\/rss(\/\w+)?(\/\w+)?/, rss.index); // 订阅资讯
zhangxiaoru authored
71
zhangxiaoru authored
72 73 74
router.get('/info/listData', index.listDynamicData);
router.get('/info/detailData', index.detailDynamicData);
75 76
router.get('/plusstar/cate', brand.index);
router.get('/plusstar/brandList', brand.brandList);
周少峰 authored
77
router.get('/sitemap.xml', sitemap.siteMap);
zhangxiaoru authored
78
ccbikai authored
79
module.exports = router;