express-graphiql-toolbox

Standalone (GraphQL toolbox version) GraphiQL middleware for express


Keywords
express, middleware, graphiql, graphql, graphql-toolbox
License
MIT
Install
npm install express-graphiql-toolbox@0.1.0

Documentation

express-graphiql-toolbox

This package is a standalone lightweight middleware (or route) for express, statically serving a GraphiQL client. It uses the graphql-toolbox version of the graphiql interface, to enable headers, tabs and more (features that people generally want, but will most likely never make it to the official GraphiQL implementation)

What you get

A live version of the graphql-toolbox version of GraphiQL: http://toolbox.sangria-graphql.org/graphiql

Installation:

npm i -S express-graphiql

Usage:

import express from 'express'
import graphiql from 'express-graphiql-toolbox'
import graphql from 'express-graphql'

const app = express()

app.use('/api', graphql({ schema: MyGraphQLSchema }))

// You can use any of the 2 versions
app.use('/explore', graphiql({ endpoint: '/api' }))
app.get('/explore-get-only', graphiql({ enpoint: '/api' }))

app.listen(3000, () => { /* we are live */ })

Big thanks

to @OlegIlyenko for creating the enhanced version of the GraphiQL library, and @tlvenn for helping it getting published on a CDN (and saving me a lots of trouble)!