Page Contents
Home > @loopback/rest > RestServer > controller
RestServer.controller() method
Register a controller class with this server.
Signature:
controller(controllerCtor: ControllerClass<ControllerInstance>): Binding;
Parameters
Parameter | Type | Description |
---|---|---|
controllerCtor | ControllerClass<ControllerInstance> | The controller class (constructor function). |
Returns:
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();