---
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

<b>Signature:</b>

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

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  verb | string | http verb |
|  path | string | http request path |
|  spec | OperationObject | OpenAPI operation spec |
|  controllerCtor | [ControllerClass](./rest.controllerclass.md)<!-- -->&lt;T&gt; | Controller class |
|  controllerFactory | [ControllerFactory](./rest.controllerfactory.md)<!-- -->&lt;T&gt; | <i>(Optional)</i> A factory function to create a controller instance |
|  methodName | string | <i>(Optional)</i> Controller method name, default to <code>x-operation-name</code> |


