JKHeadley / rest-hapi

🚀 A RESTful API generator for Node.js
https://resthapi.com
MIT License
1.19k stars 153 forks source link

Change mongoose database dynamically #159

Open gautamchitnis opened 5 years ago

gautamchitnis commented 5 years ago

I'm trying to do something simple enough, but can't figure it out for the life of me.

I am trying to change the database before using RestHapi.create() call.

I have a config file which has the basic configuration setup and i need to change that dynamically for a certain functionality.

My config file creates a manifest, exactly like in appy-backend , another project by Author of this project.

I have tried using RestHapi.config.mongo.URI = "mongodb://localhost:27017/new_db_name"; but still it doesn't change the database.

I can provide any other details that might be needed to solve this.

Please help.

JKHeadley commented 5 years ago

Hi @gautamchitnis, would you mind sharing your code where you register the rest-hapi plugin?