router.js
1018 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 cartCtrl = require(`${cRoot}/cart`); // 购物车
const order = require(`${cRoot}/order`); // 下单
// 购物车
router.get('/cart', cartCtrl.index);
router.get('/cart/product/check_inventory', cartCtrl.checkInventory);
router.post('/cart/product/:productId/change_num', cartCtrl.changeProductNum);
router.delete('/cart/product/:productId', cartCtrl.removeProduct);
router.post('/cart/product/:productId/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', order.index);
router.get('/order/compute', order.compute);
router.post('/order/submit', order.orderSub);
module.exports = router;