services-stack
Stack recursively services file on array.
You can stack function
, object
or class
.
installation
npm install services-stack
Usage
if services file is a function
, context will be automatically inject.
if services file is a class
or object
, you need to pass manualy the context, via new
for example
context
is an object
. It contains a service()
function. this allow to get services from another service.
models/
contacts.js // object
other.js // function
user/user.js // class
...
const context = db : db config : config ...; const services = path : './models' context: context; const contact = services;
Example of a service.
module { const db = ctxdb; const contacts = ctx; return ... }