---
lang: en
title: 'API docs: core.application.controller'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/core
permalink: /doc/en/lb4/apidocs.core.application.controller.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/core](./core.md) &gt; [Application](./core.application.md) &gt; [controller](./core.application.controller.md)

## Application.controller() method

Register a controller class with this application.

<b>Signature:</b>

```typescript
controller<T>(controllerCtor: ControllerClass<T>, nameOrOptions?: string | BindingFromClassOptions): Binding<T>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  controllerCtor | [ControllerClass](./core.controllerclass.md)<!-- -->&lt;T&gt; | The controller class (constructor function). |
|  nameOrOptions | string \| [BindingFromClassOptions](./context.bindingfromclassoptions.md) |  |

<b>Returns:</b>

[Binding](./context.binding.md)<!-- -->&lt;T&gt;

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();
```


