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

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

[Home](./index.md) &gt; [@loopback/express](./express.md) &gt; [toMiddleware](./express.tomiddleware.md)

## toMiddleware() function

An adapter function to create a LoopBack middleware that invokes the list of Express middleware handler functions in the order of their positions

<b>Signature:</b>

```typescript
export declare function toMiddleware(firstHandler: ExpressRequestHandler, ...additionalHandlers: ExpressRequestHandler[]): Middleware;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  firstHandler | [ExpressRequestHandler](./express.expressrequesthandler.md) | An Express middleware handler |
|  additionalHandlers | [ExpressRequestHandler](./express.expressrequesthandler.md)<!-- -->\[\] | A list of Express middleware handler functions |

<b>Returns:</b>

[Middleware](./express.middleware.md)

A LoopBack middleware function that wraps the list of Express middleware

## Example


```ts
toMiddleware(fn);
toMiddleware(fn1, fn2, fn3);
```


