@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
36 lines (25 loc) • 1.39 kB
Markdown
---
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) > [@loopback/rest](./rest.md) > [ControllerRoute](./rest.controllerroute.md) > [(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)<!-- --><T> | Controller class |
| controllerFactory | [ControllerFactory](./rest.controllerfactory.md)<!-- --><T> | A factory function to create a controller instance |
| methodName | string | Controller method name, default to <code>x-operation-name</code> |