1.8.0 • Published 6 years ago

najs-binding v1.8.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

Najs Binding

A simple and powerful dependency injection, service container, instance resolver for Node applications

Travis Maintainability Coverage Status node version npm version npm downloads npm license PRs Welcome

What is Service Container?

The Service container is a powerful tool for managing class dependencies and performing dependency injection.

For example, suppose you have a simple UserService class that contains all users from database:

// written in Javascript
class UserService {
  @autoload('UserRepository') userRepository

  getUsers() {
    return this.userRepository.getUsers()
  }
}

In this example, the UserService needs to retrieve users from a data source. So, we will inject a repository that is able to retrieve users. Since the repository is injected, we are able to easily swap it out with another implementation. We are also able to easily "mock", or create a dummy implementation of the UserRepository when testing our application.

Usage

API

register()

make()

bind()

@autoload()

ClassRegistry

License

MIT @ Nhat Phan

1.8.0

6 years ago

1.7.0

6 years ago

1.6.0

6 years ago

1.5.0

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago