ryanrhee
ryanrhee

Reputation: 2571

How do I locally test a node.js + mongodb app that works in Heroku?

I know how to run a regular node.js app locally, using foreman, but when my app is linked to a MongoHQ database in Heroku, the connection is part of the heroku environment.

Is there a way I can test the application on my local machine?

Upvotes: 4

Views: 1134

Answers (2)

friism
friism

Reputation: 19279

Foreman will load environment variables specified in the .env file of your app. It's in the Local setup section of the Configuration and Config Vars Dev Center article. There's a plugin to Heroku toolbelt that lets you pull the config from your running app, if that's what you want to use (you might also want to consider running a MongoDB server locally):

$ heroku plugins:install git://github.com/ddollar/heroku-config.git
$ heroku config:pull --overwrite --interactive        

Upvotes: 3

Have you tried installing foreman on your local machine? Take a look at the Procfile and see which processes it manages. There's probably nothing special about the Heroku machine's connection to MongoHQ. Just grep around for mongohq in the project and you'll probably find some configuration for the database connection.

Upvotes: 0

Related Questions