Monday, 8 May 2017

Pass Database URL using package.json

I'm passing the URL STRING Using package.json

  "scripts": {
    "start": "set DB_PORT=53345 && set MONGOLAB_URI='mongodb://localhost/ivr' && node server.js"

}

Console Output //

console.log(process.env.MONGOLAB_URI)   //  'mongodb://localhost/ivr'
console.log('mongodb://localhost/ivr')  // mongodb://localhost/ivr

//

Error: Invalid mongodb uri. Must begin with "mongodb://"
      Received: 'mongodb://localhost/ivr'



via Sumit Ridhal

No comments:

Post a Comment