Skip to content

GraphQL execution and error handling middleware written from scratch for Koa.

License

Notifications You must be signed in to change notification settings

jaydenseric/graphql-api-koa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

508453c · Nov 6, 2022
Jun 20, 2022
Jun 27, 2022
Sep 1, 2022
Dec 2, 2021
Jun 20, 2022
May 7, 2021
May 14, 2018
Dec 24, 2019
Dec 2, 2021
Nov 4, 2022
Nov 4, 2022
Nov 6, 2022
Nov 6, 2022
Nov 6, 2022
Jun 27, 2022
Nov 4, 2022
Jun 27, 2022
Nov 4, 2022
Jun 27, 2022
Sep 1, 2022
Jun 27, 2022
Nov 4, 2022
Nov 6, 2022
Nov 6, 2022
Apr 18, 2019
Sep 5, 2018
Jun 27, 2022
Jun 20, 2022
Nov 6, 2022
Aug 11, 2022
Nov 6, 2022

Repository files navigation

graphql-api-koa logo

graphql-api-koa

GraphQL execution and error handling middleware written from scratch for Koa.

Installation

To install graphql-api-koa and its graphql peer dependency with npm, run:

npm install graphql-api-koa graphql

Setup the Koa middleware in this order:

  1. errorHandler, to catch errors from following middleware for a correctly formatted GraphQL response.
  2. A GraphQL multipart request processor like graphqlUploadKoa from graphql-upload, to support file uploads (optional).
  3. A request body parser like koa-bodyparser.
  4. execute, to execute GraphQL.

See the execute middleware examples to get started.

Requirements

Supported runtime environments:

  • Node.js versions ^14.17.0 || ^16.0.0 || >= 18.0.0.

Projects must configure TypeScript to use types from the ECMAScript modules that have a // @ts-check comment:

Exports

The npm package graphql-api-koa features optimal JavaScript module design. It doesn’t have a main index module, so use deep imports from the ECMAScript modules that are exported via the package.json field exports: