givemetheservice

2.0.4 • Public • Published

Give Me The Service

Give me the service is a ES6 dependency injection container for OOP.

NPM Build Status Coverage Status NPM Download Dependencies Status

npm install givemetheservice --save

Features

Services

Develop your own service in a separate file. Your don't need to instanciate it. GiveMeTheService DI do that job. If you use another service just inject it in your constructor.

What is the main avantage to use DI ?

You could easily override any service. Unit testing will be easy.

## Dependency injection

Just declare the service name in your constructor. Injected services are created as singleton.

class UserService {
    constructor(config)

GiveMeTheService will create your service with its dependencies.

Lifecycle

  1. inject
  2. create()
  3. mount()
  4. unmount()

Test

To run our tests, clone the Qwebs repo and install the dependencies.

$ git clone https://github.com/BenoitClaveau/givemetheservice --depth 1
cd givemetheservice
$ npm install
cd tests
$ node.exe "../node_modules/mocha/bin/mocha" .

Package Sidebar

Install

npm i givemetheservice

Weekly Downloads

27

Version

2.0.4

License

MIT

Unpacked Size

21.4 kB

Total Files

19

Last publish

Collaborators

  • benoit.claveau