Mongoose models scheme in separate modul Mongoose models scheme in separate modul mongoose mongoose

Mongoose models scheme in separate modul


Why don't you try to export the mongoose instance from your app-core module and use it later in the web-app to connect to a database

app-core index.js

var mongoose = require('mongoose');module.exports = {    mongooseInstance: mongoose };

web-app index.js

var core = require('app-core'),    mongoose = core.mongooseInstance,mongooseClient = mongoose.connect(DB_URL);// and so on

This might work as long as you require your models in your controllers which are initialized after the code from the index.js. I hope my response is helpful.