router.js 1 KB
/**
 * router of sub app service
 * @author: xuan.chen@yoho.cn<xuan.chen@yoho.cn>
 * @date: 2016/11/21
 */

'use strict';

const router = require('express').Router(); //eslint-disable-line
const cRoot = './controllers';

const rewrite = require('../../doraemon/middleware/rewrite');
const mip = require('../../doraemon/middleware/mip');
const guang = require(`${cRoot}/guang`);
const chanpin = require(`${cRoot}/chanpin`);
const hot = require(`${cRoot}/hot`);
const productDetail = require(`${cRoot}/product-detail`);
const list = require(`${cRoot}/list`);

router.use(mip);

router.get(/^\/guang\/info\/(.*?)\.html/, rewrite.resolve, guang.detailIndex);
router.get(/^\/guang\/(.*?)\.html/, rewrite.resolve, guang.detailIndex);

router.get('/chanpin/:id.html', chanpin.index);

// router.get('/list/:id.html', chanpin.redirect);

router.get('/product/:skn.html', productDetail.index);

router.get('/hot/:id.html', hot.index);
router.get('/list(/:pathParams)?', rewrite.resolvePathParams, list.index);

module.exports = router;