Skip to content

Commit

Permalink
Added database connection
Browse files Browse the repository at this point in the history
  • Loading branch information
smashdevcode committed Mar 2, 2016
1 parent d18e144 commit 255dad1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"homepage": "https://github.com/treehouse/mean-todo#readme",
"dependencies": {
"angular": "^1.4.8",
"express": "4.13.4"
"express": "4.13.4",
"mongoose": "4.4.5"
},
"devDependencies": {
"webpack": "1.12.14"
Expand Down
2 changes: 2 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ var router = require('./api');

var app = express();

require('./database');

app.use('/', express.static('public'));

app.use('/api', router);
Expand Down
11 changes: 11 additions & 0 deletions src/database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

var mongoose = require('mongoose');

mongoose.connect('mongodb://localhost/mean-todo', function(err) {
if (err) {
console.log('Failed connecting to MongoDB!');
} else {
console.log('Successfully connected to MongoDB!');
}
});

0 comments on commit 255dad1

Please sign in to comment.