June 2018
Intermediate to advanced
348 pages
8h 19m
English
Let's start by calling the mongoose-connection module to open a connection to MongoDB. Open the server.js file and apply the following changes:
const express = require('express')const bodyParser = require('body-parser')const teamsApi = require('./src/routes/teams-api')const mongooseConfig = require('./src/config/mongoose-connection')const app = express()app.use(bodyParser.json())app.use(teamsApi)...
That's all we need to establish a new connection. The mongoose-connection file contains the logic to open a connection to MongoDB, so we don't need to type more code.
Read now
Unlock full access