Skip to content

Commit

Permalink
Connect ExpressJS to MongoDB
Browse files Browse the repository at this point in the history
  • Loading branch information
amejiarosario committed Aug 6, 2016
1 parent c6eb4d7 commit 948a323
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ var bodyParser = require('body-parser');
var routes = require('./routes/index');
var users = require('./routes/users');

// load mongoose package
var mongoose = require('mongoose');

// Use native Node promises
mongoose.Promise = global.Promise;

// connect to MongoDB
mongoose.connect('mongodb://localhost/todo-api')
.then(() => console.log('connection succesful'))
.catch((err) => console.error(err));

var app = express();

// view engine setup
Expand Down

0 comments on commit 948a323

Please sign in to comment.