UNPKG

@loopback/docs

Version:
46 lines (28 loc) 1.09 kB
--- lang: en title: 'API docs: rest.restserver.controller' keywords: LoopBack 4.0, LoopBack 4 sidebar: lb4_sidebar permalink: /doc/en/lb4/apidocs.rest.restserver.controller.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/rest](./rest.md) &gt; [RestServer](./rest.restserver.md) &gt; [controller](./rest.restserver.controller.md) ## RestServer.controller() method Register a controller class with this server. <b>Signature:</b> ```typescript controller(controllerCtor: ControllerClass<ControllerInstance>): Binding; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | controllerCtor | <code>ControllerClass&lt;ControllerInstance&gt;</code> | The controller class (constructor function). | <b>Returns:</b> `Binding` The newly created binding, you can use the reference to further modify the binding, e.g. lock the value to prevent further modifications. ## Example ```ts class MyController { } app.controller(MyController).lock(); ```