Page Contents

Home > @loopback/core

core package

The core foundation for LoopBack 4. It can also serve as the platform to build large-scale Node.js applications and frameworks.

Remarks

For examples of how to leverage @loopback/core to build composable and extensible projects, check out the core tutorial.

Classes

Class Description
[Application](/doc/en/lb4/apidocs.core.application.html) Application is the container for various types of artifacts, such as components, servers, controllers, repositories, datasources, connectors, and models.
[LifeCycleObserverRegistry](/doc/en/lb4/apidocs.core.lifecycleobserverregistry.html) A context-based registry for life cycle observers

Functions

Function Description
[addExtension(context, extensionPointName, extensionClass, options)](/doc/en/lb4/apidocs.core.addextension.html) Register an extension for the given extension point to the context
[asLifeCycleObserver(binding)](/doc/en/lb4/apidocs.core.aslifecycleobserver.html) A `BindingTemplate` function to configure the binding as life cycle observer by tagging it with `CoreTags.LIFE_CYCLE_OBSERVER`.
[asService(serviceInterface)](/doc/en/lb4/apidocs.core.asservice.html) Create a binding template for a service interface
[createServiceBinding(cls, options)](/doc/en/lb4/apidocs.core.createservicebinding.html) Create a service binding from a class or provider
[extensionFilter(extensionPointNames)](/doc/en/lb4/apidocs.core.extensionfilter.html) A factory function to create binding filter for extensions of a named extension point
[extensionFor(extensionPointNames)](/doc/en/lb4/apidocs.core.extensionfor.html) A factory function to create binding template for extensions of the given extension point
[extensionPoint(name, specs)](/doc/en/lb4/apidocs.core.extensionpoint.html) Decorate a class as a named extension point. If the decoration is not present, the name of the class will be used.
[extensions(extensionPointName, metadata)](/doc/en/lb4/apidocs.core.extensions.html) Shortcut to inject extensions for the given extension point.
[filterByServiceInterface(serviceInterface)](/doc/en/lb4/apidocs.core.filterbyserviceinterface.html) Create a binding filter by service class
[isLifeCycleObserver(obj)](/doc/en/lb4/apidocs.core.islifecycleobserver.html) Test if an object implements LifeCycleObserver
[isLifeCycleObserverClass(ctor)](/doc/en/lb4/apidocs.core.islifecycleobserverclass.html) Test if a class implements LifeCycleObserver
[lifeCycleObserver(group, specs)](/doc/en/lb4/apidocs.core.lifecycleobserver.html) Sugar decorator to mark a class as life cycle observer
[mountComponent(app, component)](/doc/en/lb4/apidocs.core.mountcomponent.html) Mount a component to an Application.
[service(serviceInterface, metadata)](/doc/en/lb4/apidocs.core.service.html) `@service` injects a service instance that matches the class or interface.

Interfaces

</tbody></table> ## Namespaces
Interface Description
[ApplicationConfig](/doc/en/lb4/apidocs.core.applicationconfig.html) Configuration for application
[ApplicationMetadata](/doc/en/lb4/apidocs.core.applicationmetadata.html) Type description for `package.json`
[ClassMap](/doc/en/lb4/apidocs.core.classmap.html) A map of classes to be bound to a context
[Component](/doc/en/lb4/apidocs.core.component.html) A component declares a set of artifacts so that they can be contributed to an application as a group
[LifeCycleObserver](/doc/en/lb4/apidocs.core.lifecycleobserver.html) Observers to handle life cycle init/start/stop events
[ProviderMap](/doc/en/lb4/apidocs.core.providermap.html) A map of provider classes to be bound to a context
[Server](/doc/en/lb4/apidocs.core.server.html) Defines the requirements to implement a Server for LoopBack applications: start() : Promise stop() : Promise It is recommended that each Server implementation creates its own child Context, which inherits from the parent Application context. This way, any Server-specific bindings will remain local to the Server instance, and will avoid polluting its parent module scope. </td></tr>
[ServiceOptions](/doc/en/lb4/apidocs.core.serviceoptions.html) Options to register a service binding
Namespace Description
[CoreBindings](/doc/en/lb4/apidocs.core.corebindings.html) Namespace for core binding keys
[CoreTags](/doc/en/lb4/apidocs.core.coretags.html)
[extensions](/doc/en/lb4/apidocs.core.extensions.html)
## Variables
Variable Description
[DEFAULT\_ORDERED\_GROUPS](/doc/en/lb4/apidocs.core.default_ordered_groups.html)
[lifeCycleObserverFilter](/doc/en/lb4/apidocs.core.lifecycleobserverfilter.html) Find all life cycle observer bindings. By default, a binding tagged with `CoreTags.LIFE_CYCLE_OBSERVER`. It's used as `BindingFilter`.
## Type Aliases
Type Alias Description
[ControllerClass](/doc/en/lb4/apidocs.core.controllerclass.html)
[LifeCycleObserverGroup](/doc/en/lb4/apidocs.core.lifecycleobservergroup.html) A group of life cycle observers
[LifeCycleObserverOptions](/doc/en/lb4/apidocs.core.lifecycleobserveroptions.html)
[MixinTarget](/doc/en/lb4/apidocs.core.mixintarget.html) A replacement for `typeof Target` to be used in mixin class definitions. This is a workaround for TypeScript limitation described in - https://github.com/microsoft/TypeScript/issues/17293 - https://github.com/microsoft/TypeScript/issues/17744 - https://github.com/microsoft/TypeScript/issues/36060
[ServiceInterface](/doc/en/lb4/apidocs.core.serviceinterface.html) Representing an interface for services. In TypeScript, the `interface` does not have reflections at runtime. We use a string, a symbol or a Function as the type for the service interface.
[ServiceOrProviderClass](/doc/en/lb4/apidocs.core.serviceorproviderclass.html)
[ShutdownOptions](/doc/en/lb4/apidocs.core.shutdownoptions.html) Options to set up application shutdown