Page Contents

Home > @loopback/core > Application

Application class

Application is the container for various types of artifacts, such as components, servers, controllers, repositories, datasources, connectors, and models.


export declare class Application extends Context implements LifeCycleObserver 


Constructor Modifiers Description
(constructor)(options)   Constructs a new instance of the Application class


Property Modifiers Type Description
options   ApplicationConfig  


Method Modifiers Description
component(componentCtor, name)   Add a component to this application and register extensions such as controllers, providers, and servers from the component.
controller(controllerCtor, name)   Register a controller class with this application.
getServer(target)   Retrieve the singleton instance for a bound server.
lifeCycleObserver(ctor, name)   Register a life cycle observer class
server(ctor, name)   Bind a Server constructor to the Application’s master context. Each server constructor added in this way must provide a unique prefix to prevent binding overlap.
servers(ctors)   Bind an array of Server constructors to the Application’s master context. Each server added in this way will automatically be named based on the class constructor name with the “servers.” prefix.
service(cls, name)   Add a service to this application.
setMetadata(metadata)   Set application metadata. @loopback/boot calls this method to populate the metadata from package.json.
start()   Start the application, and all of its registered observers.
stop()   Stop the application instance and all of its registered observers.