router.js
991 Bytes
/**
* router of sub app shopping
* @author: jinhu.dong<jinhu.dong@yoho.cn>
* @date: 2016/07/04
*/
'use strict';
const router = require('express').Router(); // eslint-disable-line
const cRoot = './controllers';
const auth = require(`${global.middleware}/auth`);
const cartCtrl = require(`${cRoot}/cart`); // 购物车
const order = require(`${cRoot}/order`); // 下单
// 购物车
router.get('/cart', cartCtrl.index);
router.post('/cart/product/change_num', cartCtrl.changeProductNum);
router.delete('/cart/product/remove', cartCtrl.removeProduct);
router.post('/cart/product/send_to_favorite', cartCtrl.sendToFavorite);
router.get('/cart/product/:productId/edit', cartCtrl.editProduct);
router.post('/cart/add', cartCtrl.addToCart);
router.post('/cart/toggleSelectGoods', cartCtrl.toggleSelectGoods);
// 结算
router.get('/order', auth, order.index);
router.get('/order/compute', auth, order.compute);
router.post('/order/submit', auth, order.orderSub);
module.exports = router;