Created
February 14, 2014 14:34
-
-
Save jonatasnona/9001975 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// database.js file | |
var client = require("mongodb").MongoClient; | |
client.connect('mongodb://127.0.0.1:27017/foodb', function (err, db) { | |
if (err) { | |
throw err; | |
} | |
exports.users = db.collection("users"); | |
exports.sessions = db.collection("sessions"); | |
exports.destroy = db.close; | |
}); | |
// user.js file (loading collection) | |
var users = require("database").users; | |
// session.js file (loading collection) | |
var sessions = require("database").sessions; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment