Skip to content

Chaining app controller path wrong #6

@mytharcher

Description

@mytharcher

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions