Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/benawad/express-gql

Express GraphQL Server with Validation Caching and graphql-jit
https://github.com/benawad/express-gql

express graphql node

Last synced: 17 days ago
JSON representation

Express GraphQL Server with Validation Caching and graphql-jit

Awesome Lists containing this project

README

        

# 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

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