@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
44 lines (28 loc) • 1.32 kB
Markdown
---
lang: en
title: 'API docs: express.tointerceptor'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/express
permalink: /doc/en/lb4/apidocs.express.tointerceptor.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/express](./express.md) > [toInterceptor](./express.tointerceptor.md)
## toInterceptor() function
Wrap an express middleware handler function as an interceptor
<b>Signature:</b>
```typescript
export declare function toInterceptor<CTX extends Context = InvocationContext>(firstHandler: ExpressRequestHandler, ...additionalHandlers: ExpressRequestHandler[]): GenericInterceptor<CTX>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| firstHandler | [ExpressRequestHandler](./express.expressrequesthandler.md) | An Express middleware handler |
| additionalHandlers | [ExpressRequestHandler](./express.expressrequesthandler.md)<!-- -->\[\] | A list of Express middleware handler function |
<b>Returns:</b>
[GenericInterceptor](./context.genericinterceptor.md)<!-- --><CTX>
## Example
```ts
toInterceptor(fn);
toInterceptor(fn1, fn2, fn3);
```