JKHeadley / rest-hapi

🚀 A RESTful API generator for Node.js

Home Page:https://resthapi.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change mongoose database dynamically

gautamchitnis opened this issue · comments

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.

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