Created
December 28, 2017 21:51
-
-
Save aramkoukia/4447a6752c2bd8e9e52fe83bd74c3e3d 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
| const mongoose = require('mongoose'); | |
| /** | |
| * Set to Node.js native promises | |
| * Per http://mongoosejs.com/docs/promises.html | |
| */ | |
| mongoose.Promise = global.Promise; | |
| // Cosmos DB Connection String | |
| // eslint-disable-next-line max-len | |
| const mongoUri = `mongodb://${process.env.COSMOSDB_ACCOUNT}:${process.env.COSMOSDB_KEY}@${ | |
| process.env.COSMOSDB_ACCOUNT | |
| }.documents.azure.com:${process.env.COSMOSDB_PORT}/${process.env.COSMOSDB_DB}?ssl=true`; | |
| // &replicaSet=globaldb`; | |
| // Local MongoDB Connection String | |
| // const mongoUri = `mongodb://localhost:27017/connect-todoes`; | |
| function connect() { | |
| mongoose.set('debug', true); | |
| return mongoose.connect(mongoUri, { useMongoClient: true }); | |
| } | |
| module.exports = { | |
| connect, | |
| mongoose | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment