| lang | en |
|---|---|
| title | Using components |
| keywords | LoopBack 4.0, LoopBack 4 |
| sidebar | lb4_sidebar |
| permalink | /doc/en/lb4/Using-components.html |
Components serve as a vehicle to group third-party contributions to allow easier extensibility of your Application, see Components for more details.
Components can be added to your application using the app.component() method.
The following is an example of installing and using a component.
Install the following dependencies:
npm install --save @loopback/authenticationTo load the component in your application:
import {RestApplication} from '@loopback/rest';
import {AuthenticationComponent} from '@loopback/authentication';
const app = new RestApplication();
// Add component to Application, which provides bindings used to resolve
// authenticated requests in a Sequence.
app.component(AuthenticationComponent);LoopBack ships the following components:
- Health check: @loopback/extension-health (Experimental)
- Metrics for Prometheus: @loopback/extension-metrics (Experimental)