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

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

[Home](./index.md) &gt; [@loopback/rest](./rest.md) &gt; [RestApplication](./rest.restapplication.md) &gt; [expressMiddleware](./rest.restapplication.expressmiddleware_1.md)

## RestApplication.expressMiddleware() method

Bind an Express middleware to this server context

<b>Signature:</b>

```typescript
expressMiddleware<CFG>(middlewareFactory: ExpressMiddlewareFactory<CFG>, middlewareConfig?: CFG, options?: MiddlewareBindingOptions): Binding<Middleware>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  middlewareFactory | [ExpressMiddlewareFactory](./express.expressmiddlewarefactory.md)<!-- -->&lt;CFG&gt; | Middleware module name or factory function |
|  middlewareConfig | CFG | Middleware config |
|  options | [MiddlewareBindingOptions](./express.middlewarebindingoptions.md) | Options for registration |

<b>Returns:</b>

[Binding](./context.binding.md)<!-- -->&lt;[Middleware](./express.middleware.md)<!-- -->&gt;

## Example


```ts
import myExpressMiddlewareFactory from 'my-express-middleware';
const myExpressMiddlewareConfig= {};
server.expressMiddleware(myExpressMiddlewareFactory, myExpressMiddlewareConfig);

```


