jeudi 28 avril 2016

Register a node module during design time

Im implementing a node application that have app.js and server.js (using express) . To run my application you should run the server.js which start to listen to http calls. so far so good :).

There is a new requirement like following:

  1. Register new module to the application during design time like adding new module to it

  2. in Runtime find which modules are register and do my logic on them

I think its like command design pattern that external module can register to your module and you don't know about them until the need to run

How I can do it in node.js? There is a npm module which allow module registration which I can use as reference ?

I'm not talking about adding a module as node dependency(on package.json), I'm referring that developer will add/register his module to my module by code and in runtime I will know that userModule was register and do additional logic.

Aucun commentaire:

Enregistrer un commentaire