March 2018
Intermediate to advanced
592 pages
13h 44m
English
To get started, inside of the server folder, we're going to make a new folder called db, and inside of the db folder we'll make a file where all of this Mongoose configuration will happen. I'm going to call that file mongoose.js, and all we need to do is take our Mongoose configuration code right here:
var mongoose = require('mongoose');
mongoose.Promise = global.Promise;
mongoose.connect('mongodb://localhost:27017/TodoApp');
Cut it out, and to move it over into mongoose.js. Now, we need to export something. What we're going to export is the mongoose variable. So essentially, when someone requires the mongoose.js file, they're going to have Mongoose configured and they're going to ...