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

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

[Home](./index.md) &gt; [@loopback/rest](./rest.md) &gt; [ControllerRoute](./rest.controllerroute.md) &gt; [(constructor)](./rest.controllerroute._constructor_.md)

## ControllerRoute.(constructor)

Construct a controller based route

**Signature:**

```typescript
constructor(verb: string, path: string, spec: OperationObject, controllerCtor: ControllerClass<T>, controllerFactory?: ControllerFactory<T>, methodName?: string);
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

verb


</td><td>

string


</td><td>

http verb


</td></tr>
<tr><td>

path


</td><td>

string


</td><td>

http request path


</td></tr>
<tr><td>

spec


</td><td>

OperationObject


</td><td>

OpenAPI operation spec


</td></tr>
<tr><td>

controllerCtor


</td><td>

[ControllerClass](./rest.controllerclass.md)<!-- -->&lt;T&gt;


</td><td>

Controller class


</td></tr>
<tr><td>

controllerFactory


</td><td>

[ControllerFactory](./rest.controllerfactory.md)<!-- -->&lt;T&gt;


</td><td>

_(Optional)_ A factory function to create a controller instance


</td></tr>
<tr><td>

methodName


</td><td>

string


</td><td>

_(Optional)_ Controller method name, default to `x-operation-name`


</td></tr>
</tbody></table>


