Skip to content

Instantly share code, notes, and snippets.

@TaylorAckley
Created February 13, 2017 16:35
Show Gist options
  • Save TaylorAckley/ca11d1bf30d7a3c012588737de8f0f8b to your computer and use it in GitHub Desktop.
Save TaylorAckley/ca11d1bf30d7a3c012588737de8f0f8b to your computer and use it in GitHub Desktop.
"use strict";
const appConfig = require('../config.js');
const mongoose = require('mongoose');
mongoose.connect(appConfig.MONGOLAB_URI);
mongoose.connection.on('error', (err) => {
console.log('Error: Could not connect to MongoDB. Did you forget to run `mongod`?');
});
mongoose.connection.once('open', (err) => {
console.log('Connected to MongoDb');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment