I want to use a local mongo server in development and then switch to a mongolab db in production. What is the recommended way to do this in a node.js express app? All I know is that NODE_ENV exists but not sure on the best way to switch the database based on its value. Having:
if (process.env.NODE_ENV == "production")
{
//
}
else if ((process.env.NODE_ENV == "development")
{
}
All over the place where I query the db doesn't seem very elegant. Is there a way to do it similar to a rail app where you specify you adapter for production and development?