1.2.0 • Published 8 years ago

services-stack v1.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

services-stack

Node.js Version NPM version build status Dependency Status Coverage Status

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 = require('services-stack')({
    path : './models'
    context: context
});

const contact = services.get('contacts');

Example of a service.

module.exports = ctx => {
    const db = ctx.db;
    const contacts = ctx.service('contacts');

    return {
        ...
    }
}
1.2.0

8 years ago

1.1.0

8 years ago

1.0.3

9 years ago

1.0.2

9 years ago