npm install --save mongodb
npm install --save mongoose //A simple wrapper for ease of development
In your server file (normally named index.js or server.js)
const express = require('express');
const mongodb = require('mongodb');
const mongoose = require('mongoose');
const mongoConnectString = 'http://localhost/database name';
mongoose.connect(mongoConnectString, (err) => {
if (err) {
console.log('Could not connect to the database');
}
});