Page Contents
Home > @loopback/core > Application > controller
Application.controller() method
Register a controller class with this application.
Signature:
controller<T>(controllerCtor: ControllerClass<T>, nameOrOptions?: string | BindingFromClassOptions): Binding<T>;
Parameters
Parameter | Type | Description |
---|---|---|
controllerCtor | ControllerClass<T> | The controller class (constructor function). |
nameOrOptions | string | BindingFromClassOptions | (Optional) |
Returns:
Binding<T>
The newly created binding, you can use the reference to further modify the binding, e.g. lock the value to prevent further modifications.
Example
class MyController {
}
app.controller(MyController).lock();