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

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

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

## express package

The Express integration package for loopback-next.

## Remarks

This module introduces Koa style cascading middleware that leverage `async/await`<!-- -->. It also enables the ability to plug in existing Express middleware as LoopBack middleware or interceptors so that they can be used at sequence/action, global interceptor, and local interceptor tiers.

This module also serves as a standalone extension to Express to provide extensibility and composability for large-scale Express applications by leveraging LoopBack's Dependency Injection and Extension Point/Extension pattern.

## Classes

|  Class | Description |
|  --- | --- |
|  [BaseMiddlewareRegistry](./express.basemiddlewareregistry.md) | Base Context that provides APIs to register middleware |
|  [ExpressApplication](./express.expressapplication.md) | A LoopBack application with Express server |
|  [ExpressMiddlewareInterceptorProvider](./express.expressmiddlewareinterceptorprovider.md) | Base class for MiddlewareInterceptor provider classes |
|  [ExpressServer](./express.expressserver.md) | An Express server that provides middleware composition and injection |
|  [InvokeMiddlewareProvider](./express.invokemiddlewareprovider.md) | Extension point for middleware to be run as part of the sequence actions |
|  [MiddlewareChain](./express.middlewarechain.md) | An interceptor chain of middleware. This represents a list of cascading middleware functions to be executed by the order of <code>group</code> names. |
|  [MiddlewareContext](./express.middlewarecontext.md) | A per-request Context for middleware to combine an IoC container with handler context (request, response, etc.). |
|  [MiddlewareView](./express.middlewareview.md) | Watch middleware binding keys for the given context and sort them by group |

## Functions

|  Function | Description |
|  --- | --- |
|  [asMiddleware(options)](./express.asmiddleware.md) | Template function for middleware bindings |
|  [buildName(middlewareFactory, providedName, suffix)](./express.buildname.md) | Build a name for the middleware |
|  [createInterceptor(middlewareFactory, middlewareConfig)](./express.createinterceptor.md) | Create an interceptor function from express middleware. |
|  [createMiddleware(middlewareFactory, middlewareConfig)](./express.createmiddleware.md) | An adapter function to create a LoopBack middleware from Express middleware factory function and configuration object. |
|  [createMiddlewareBinding(middlewareProviderClass, options)](./express.createmiddlewarebinding.md) | Create a binding for the middleware provider class |
|  [createMiddlewareInterceptorBinding(middlewareProviderClass, options)](./express.createmiddlewareinterceptorbinding.md) | Create a binding for the middleware based interceptor |
|  [defineInterceptorProvider(middlewareFactory, defaultMiddlewareConfig, options)](./express.defineinterceptorprovider.md) | Define a provider class that wraps the middleware as an interceptor |
|  [executeExpressRequestHandler(handler, request, response)](./express.executeexpressrequesthandler.md) | Execute an Express-style callback-based request handler. |
|  [getMiddlewareContext(request)](./express.getmiddlewarecontext.md) | A helper function to retrieve the MiddlewareContext/RequestContext from the request object |
|  [invokeExpressMiddleware(middlewareCtx, handlers)](./express.invokeexpressmiddleware.md) | Invoke a list of Express middleware handler functions |
|  [invokeMiddleware(middlewareCtx, options)](./express.invokemiddleware.md) | Discover and invoke registered middleware in a chain for the given extension point. |
|  [MiddlewareMixin(superClass)](./express.middlewaremixin.md) |  |
|  [registerExpressMiddleware(ctx, middlewareFactory, middlewareConfig, options)](./express.registerexpressmiddleware.md) | Bind a Express middleware to the given context |
|  [registerExpressMiddlewareInterceptor(ctx, middlewareFactory, middlewareConfig, options)](./express.registerexpressmiddlewareinterceptor.md) | Bind a middleware interceptor to the given context |
|  [registerMiddleware(ctx, middleware, options)](./express.registermiddleware.md) | Bind the middleware function or provider class to the context |
|  [sortListOfGroups(orderedGroups)](./express.sortlistofgroups.md) | Sort the groups by their relative order |
|  [toExpressMiddleware(ctx)](./express.toexpressmiddleware.md) | An adapter function to create an Express middleware handler to discover and invoke registered LoopBack-style middleware in the context. |
|  [toInterceptor(firstHandler, additionalHandlers)](./express.tointerceptor.md) | Wrap an express middleware handler function as an interceptor |
|  [toMiddleware(firstHandler, additionalHandlers)](./express.tomiddleware.md) | An adapter function to create a LoopBack middleware that invokes the list of Express middleware handler functions in the order of their positions |

## Interfaces

|  Interface | Description |
|  --- | --- |
|  [BaseMiddlewareBindingOptions](./express.basemiddlewarebindingoptions.md) | Options to create a middleware binding for the sequence action or interceptor. |
|  [ExpressMiddlewareFactory](./express.expressmiddlewarefactory.md) | Interface for an express middleware factory |
|  [HandlerContext](./express.handlercontext.md) | An object holding HTTP request, response and other data needed to handle an incoming HTTP request. |
|  [InvokeMiddleware](./express.invokemiddleware.md) | Interface for the invoker of middleware registered under the an extension point name. |
|  [InvokeMiddlewareOptions](./express.invokemiddlewareoptions.md) | Options for <code>InvokeMiddleware</code> |
|  [Middleware](./express.middleware.md) | Interface LoopBack 4 middleware to be executed within sequence of actions. A middleware for LoopBack is basically a generic interceptor that uses <code>MiddlewareContext</code>. |
|  [MiddlewareBindingOptions](./express.middlewarebindingoptions.md) | Options to bind middleware as a request context based interceptor within an <code>InvokeMiddleware</code> action of the sequence. |
|  [MiddlewareCreationOptions](./express.middlewarecreationoptions.md) | Options for defining a middleware |
|  [MiddlewareInterceptorBindingOptions](./express.middlewareinterceptorbindingoptions.md) | Options to bind a middleware as an interceptor to the context |
|  [MiddlewareRegistry](./express.middlewareregistry.md) | A context that allows middleware registration |

## Namespaces

|  Namespace | Description |
|  --- | --- |
|  [MiddlewareBindings](./express.middlewarebindings.md) |  |
|  [MiddlewareGroups](./express.middlewaregroups.md) | Constants for middleware groups |

## Variables

|  Variable | Description |
|  --- | --- |
|  [DEFAULT\_MIDDLEWARE\_CHAIN](./express.default_middleware_chain.md) | Default extension point name for middleware |
|  [DEFAULT\_MIDDLEWARE\_GROUP](./express.default_middleware_group.md) | Default order group name for Express middleware based global interceptors |
|  [GLOBAL\_MIDDLEWARE\_INTERCEPTOR\_NAMESPACE](./express.global_middleware_interceptor_namespace.md) | Default namespace for Express middleware based global interceptors |
|  [MIDDLEWARE\_CONTEXT](./express.middleware_context.md) | A symbol to store <code>MiddlewareContext</code> on the request object. This symbol can be referenced by name, before it is created. |
|  [MIDDLEWARE\_INTERCEPTOR\_NAMESPACE](./express.middleware_interceptor_namespace.md) | Default namespace for Express middleware based local interceptors |
|  [MIDDLEWARE\_NAMESPACE](./express.middleware_namespace.md) | Default namespaces for middleware |

## Type Aliases

|  Type Alias | Description |
|  --- | --- |
|  [ExpressRequestHandler](./express.expressrequesthandler.md) | Type alias for Express RequestHandler |
|  [ExpressServerConfig](./express.expressserverconfig.md) | Configuration for a LoopBack based Express server |
|  [MiddlewareOrKey](./express.middlewareorkey.md) | A middleware function or binding key |


