Created
January 20, 2017 17:02
-
-
Save asipser/94f00104d74e844a3a35c0efd13df654 to your computer and use it in GitHub Desktop.
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
// database setup | |
mongoose.connect(process.env.MONGOLAB_URI || 'MongoDB URI Goes here!'); | |
/* | |
Example localhost: 'mongodb://localhost:27017/test'; | |
Example Azure URI: mongodb://aaronsmongodbrw:xSJEozk4Tmg74Q1iyXMN0sEgr0PfegnIrDz5xq8N5UvmwlsFSSqGR0QMAx1nw5hdiENdcSQbHHK7t4ZQY0wf6g==@aaronsmongodbrw.documents.azure.com:10250/<db_name>?ssl=true | |
Example Heroku (MongoLab) URI: 'mongodb://<db_user>:<db_pass>@ds117919.mlab.com:17919/heroku_n54n38l8'; | |
*/ | |
var connection = mongoose.connection; | |
connection.on('error', console.error.bind(console, 'connection error:')); | |
connection.on('connected', function() { | |
console.log('database connected!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment