0

I found several tutorials and examples on how to deploy a Node.js app to Heroku but most of those suppose you're using Mongoose or mLab while I'm using Monk.

So in my app.js I have:

var db = monk('localhost:27017/dbname');

[...]

app.use(function(req,res,next){
  req.db = db;
  next();
});

All I need is to store users/members and maybe eventually to show some data out of the info recorded in the DB during the registration process. This just to say that there will not be a lot of tables nor complex DB interactions.

In the dev environment everything is working well and I'm thinking of deploying a first version to Heroku, but I'm just very confused about how to handle all this DB stuff.

I suppose I still want to use my local DB when I'm developing while a different DB will be used in the production system but I'm really not sure how to set this up (and actually handle the production DB).

So my question is basically how do I make my app use a different connection string when deploying in production? Do you also have suggestions about the db to use in production considering I'm deploying to Heroku?

I would appreciate if someone could point me in the right direction, thanks.

Tommy
  • 628
  • 11
  • 22
  • What is the question? Because this looks like you are asking for a tutorial, which would be way to broad and off-topic. Somehow "hidden in all the rambling" I'm guessing your real question is *"How do I make my application use a different connection string in production deployment?"*. And that question ( if directly asked ) actually has existing answers. – Neil Lunn Aug 16 '17 at 03:13
  • @NeilLunn I'm sorry reading my question again I was fearing it would be indeed to broad and thinking about how to edit it to make it clear. Yeah I guess actually my question boils down to what you just said. I edited my post making this clear, thank you. – Tommy Aug 16 '17 at 03:15

0 Answers0