Now, we have to modify the sign up route so every user who sign up will have a shopping cart. First, we have to delete all the users from the database because they are signed up but they don’t have a shopping cart.
Log in to the mlab.com website, go to the users, and delete all the documents from the collection. Now, there are no users in the database.
Now, go to
routes folder and open the
user.js file. First, we have to require
async. Just below
var User = require('../models/user'); type in the following two lines of code.
var Cart = require('../models/cart'); var async = require('async');