Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Connect ExpressJS to MongoDB
- Loading branch information
Showing
with
10 additions
and
0 deletions.
-
+9
−0
app.js
-
+1
−0
package.json
|
@@ -8,6 +8,15 @@ var bodyParser = require('body-parser'); |
|
|
var routes = require('./routes/index'); |
|
|
var users = require('./routes/users'); |
|
|
|
|
|
var mongoose = require('mongoose'); |
|
|
mongoose.connect('mongodb://localhost/todoApp', function(err) { |
|
|
if(err) { |
|
|
console.log('connection error', err); |
|
|
} else { |
|
|
console.log('connection successful'); |
|
|
} |
|
|
}); |
|
|
|
|
|
var app = express(); |
|
|
|
|
|
// view engine setup |
|
|
|
@@ -11,6 +11,7 @@ |
|
|
"debug": "~2.0.0", |
|
|
"ejs": "~0.8.5", |
|
|
"express": "~4.9.0", |
|
|
"mongoose": "^3.8.17", |
|
|
"morgan": "~1.3.0", |
|
|
"serve-favicon": "~2.1.3" |
|
|
} |
|
|