When chaining multi express application together, the controller path calculation based on module.parent of node will be wrong.
app1.js
var express = require('express');
var rainbow = require('rainbow');
var app = express();
app.use('/', rainbow({controllers: 'app1/controllers'}));
module.exports = app;
app2.js
var rainbow = require('rainbow');
var app = require('app1');
app.use('/app2', rainbow({controllers: 'app2/controllers'}))
Then when start the app2, the twice rainbow scanning are always on the app2/controllers path. This made the controllers/routers in app1 which required by app2 cannot be initialized.
This issues mostly caused by the module.parant with node module cache.
When chaining multi express application together, the controller path calculation based on
module.parentof node will be wrong.app1.js
app2.js
Then when start the app2, the twice rainbow scanning are always on the
app2/controllerspath. This made the controllers/routers in app1 which required by app2 cannot be initialized.This issues mostly caused by the
module.parantwith node module cache.