Tag Archives: Create Cart Route in Node.js

Building an e-Commerce website with Node – Part 45 – Create Cart Route in Node.js

Now, we are going to create a Cart route. Open the main.js in the routes folder and type in the following route just above the line router.post('/product/:product_id' ….

router.get('/cart', function(req, res, next) {
    .findOne({ owner: req.user._id })
    .exec(function(err, foundCart) {
      if (err) return next(err);
      res.render('main/cart', {
        foundCart: foundCart,
        message: req.flash('remove')

Continue reading