Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 2 months ago
JSON representation
Express GraphQL Server with Validation Caching and graphql-jit
- Host: GitHub
- URL: https://github.com/benawad/express-gql
- Owner: benawad
- License: mit
- Created: 2020-01-08T19:35:42.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-23T20:26:26.000Z (almost 3 years ago)
- Last Synced: 2024-10-24T11:20:19.645Z (2 months ago)
- Topics: express, graphql, node
- Language: TypeScript
- Homepage:
- Size: 20.5 KB
- Stars: 51
- Watchers: 5
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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