I am making a node.js express application (express-generator in case that helps) that is deployed to Heroku. I am using an AWS atlas cluster, and I am pretty knew to this. I am using mongoose in my express app. I was wondering, is there anything I should do so that me running on my localhost in development or people who visit my website at the heroku deployed can access and retrieve and send data with the site? I am simply doing a login, register, profile information functionality that stores in atlas.
I read a mongodb blog post about heroku with mongodb, but it did not really apply to me because they were not using mongoose but an npm lib called mongodb?
I don’t really do anything like a development or production environment, I simply write the code, run it on my localhost, then it is deployed automatically to Heroku with a ci on every commit and push.
I was wondering, is there anything I should do so that me running on my localhost in development or people who visit my website at the heroku deployed can access and retrieve and send data with the site?
In Heroku you could configure environment variables. With this you could set an environment variable where your application could read the env variable value to determine which database cluster to connect to. For example, you could set an environment variable called ATLAS_URI which contains a MongoDB Connection String URI that points to your Atlas cluster.
I read a mongodb blog post about heroku with mongodb, but it did not really apply to me because they were not using mongoose but an npm lib called mongodb?
mongoose is an ODM library that utilises MongoDB Node JS driver (mongodb npm package) behind the scene. Which MongoDB + Heroku blog post are you referring to ?
If you still have a question about MongoDB and Heroku, it would be helpful if you could elaborate further on:
What you’re trying to achieve
What problem that you’re encountering i.e. error message