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](/doc/en/lb4/apidocs.rest.controllerclass.html)<[ControllerInstance](/doc/en/lb4/apidocs.rest.controllerinstance.html)> | 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();