---
lang: en
title: 'API docs: rest.controllerfactory'
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.controllerfactory.html
---

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

[Home](./index.md) &gt; [@loopback/rest](./rest.md) &gt; [ControllerFactory](./rest.controllerfactory.md)

## ControllerFactory type

A factory function to create controller instances synchronously or asynchronously

**Signature:**

```typescript
export type ControllerFactory<T extends ControllerInstance> = (ctx: Context) => ValueOrPromise<T>;
```
**References:** [ControllerInstance](./rest.controllerinstance.md)<!-- -->, [Context](./context.context.md)<!-- -->, [ValueOrPromise](./context.valueorpromise.md)


