---
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

<b>Signature:</b>

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

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  middleware | Middleware&lt;T&gt; | GraphQL middleware |

<b>Returns:</b>

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


