Overview

When using dependency injection there are a fewthings to keep in mind with regards to binding keys.

Different packages and components for LoopBack 4 may have some bindings alreadydefined. You can change the default behavior by overriding the default binding,but you must ensure the interface of the new binding is the same as the default(but behavior can be different).

It is recommended to use the CONSTANT defined for each binding key in it’srespective namespace. You can import a namespace and access the binding key inyour application as follows:

  1. import {BindingKeyNameSpace} from 'package-name';
  2. app.bind(BindKeyNameSpace.KeyName).to('value');

Following is a list of links to the apidocs on the binding keys in use byvarious @loopback packages:

Declaring new binding keys

For component developers creating a new Binding, to avoid conflict with otherpackages, it is recommended that the binding key start with the package name asthe prefix. Example: @loopback/authentication component uses the prefixauthentication for its binding keys.