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

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

[Home](./index.md) &gt; [@loopback/express](./express.md) &gt; [createMiddleware](./express.createmiddleware.md)

## createMiddleware() function

An adapter function to create a LoopBack middleware from Express middleware factory function and configuration object.

**Signature:**

```typescript
export declare function createMiddleware<CFG>(middlewareFactory: ExpressMiddlewareFactory<CFG>, middlewareConfig?: CFG): Middleware;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  middlewareFactory | [ExpressMiddlewareFactory](./express.expressmiddlewarefactory.md)<!-- -->&lt;CFG&gt; | Express middleware factory function |
|  middlewareConfig | CFG | _(Optional)_ Express middleware config |

**Returns:**

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

A LoopBack middleware function that wraps the Express middleware


