Created
August 21, 2013 19:37
-
-
Save anonymous/6299143 to your computer and use it in GitHub Desktop.
Code modularity / organization
This file contains 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
module.exports = function(){ | |
var mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/app'); | |
var db = mongoose.connection; | |
var usrSchema = new mongoose.Schema({ | |
user: { type: String, required: true }, | |
password: { type: String, required: true }, | |
DLU: { type: Date } | |
}); | |
var User = mongoose.model('user', userSchema); | |
} |
This file contains 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
require('./db'); | |
/* | |
var mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/app'); | |
var db = mongoose.connection; | |
var usrSchema = new mongoose.Schema({ | |
user: { type: String, required: true }, | |
password: { type: String, required: true }, | |
DLU: { type: Date } | |
}); | |
var User = mongoose.model('user', userSchema); | |
*/ | |
User.find(function(err,docs){ | |
console.log(docs); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment