express-gql
TypeScript icon, indicating that this package has built-in type declarations

0.0.11 • Public • Published

express-gql

This is a mix between fastify-gql and graphql-api-koa for Express.

Why

I wanted to use fastify-gql but I relied on some Express middleware, so I took the GraphQL caching techniques used in fastify-gql and copied them into some express middleware.

Setup

yarn add express-gql

Usage

const bodyParser = require("body-parser");
const { createGraphqlMiddleware } = require("express-gql");
const express = require("express");
const schema = require('./schema');

const app = express();

app.post(
  "/graphql",
  bodyParser.json(),
  createGraphqlMiddleware({
    context: ({ req, res }) => ({}),
    formatError: ({ req, error }) => error,
    schema
  })
);

Subscriptions

https://github.com/apollographql/subscriptions-transport-ws

Readme

Keywords

none

Package Sidebar

Install

npm i express-gql

Weekly Downloads

7

Version

0.0.11

License

MIT

Unpacked Size

17.7 kB

Total Files

12

Last publish

Collaborators

  • benawad