---
lang: en
title: 'API docs: rest.createroutesforcontroller'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/rest
permalink: /doc/en/lb4/apidocs.rest.createroutesforcontroller.html
---

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

[Home](./index.md) &gt; [@loopback/rest](./rest.md) &gt; [createRoutesForController](./rest.createroutesforcontroller.md)

## createRoutesForController() function

Create routes for a controller with the given spec

<b>Signature:</b>

```typescript
export declare function createRoutesForController<T>(spec: ControllerSpec, controllerCtor: ControllerClass<T>, controllerFactory?: ControllerFactory<T>): ControllerRoute<T>[];
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  spec | <code>ControllerSpec</code> | Controller spec |
|  controllerCtor | <code>ControllerClass&lt;T&gt;</code> | Controller class |
|  controllerFactory | <code>ControllerFactory&lt;T&gt;</code> | Controller factory |

<b>Returns:</b>

`ControllerRoute<T>[]`


