---
lang: en
title: 'API docs: graphql.graphqlserver.middleware'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/extensions/graphql
permalink: /doc/en/lb4/apidocs.graphql.graphqlserver.middleware.html
---

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

[Home](./index.md) &gt; [@loopback/graphql](./graphql.md) &gt; [GraphQLServer](./graphql.graphqlserver.md) &gt; [middleware](./graphql.graphqlserver.middleware.md)

## GraphQLServer.middleware() method

Register a GraphQL middleware

**Signature:**

```typescript
middleware<T extends object = object>(middleware: Middleware<T>): Binding<Middleware<T>>;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

middleware


</td><td>

Middleware&lt;T&gt;


</td><td>

GraphQL middleware


</td></tr>
</tbody></table>

**Returns:**

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


