0.6.1 • Published 7 years ago
@marvinh/fast-graphql-server v0.6.1
Fast GraphQL Server
This project is a fork of the excellent apollo-server. The main difference is a much smaller code-base and it currently only has an adapter for micro-opinions
For the full doc please read the apollo-server docs
Installation
# npm
npm install --save @marvinh/fast-graphql-server
# yarn
yarn add @marvinh/fast-graphql-server
Usage
import { mhGraphql, mhGraphiql } from "@marvinh/fast-graphql-server";
import { router, match } from "@marvinh/micro-opinions";
import micro from "micro";
// Your graphql schema
const file = fs.readFileSync("path/to/schema.graphql", "utf8");
const schema = buildSchema(file);
export function micro(async (req, res) => {
const result = await router([
match("GET", "/graphql", mhGraphql({ schema })),
match("POST", "/graphql", mhGraphql({ schema })),
// GraphiQL
match("GET", "/graphiql", mhGraphiql({ endpointURL: "/graphql", })),
match("POST", "/graphiql", mhGraphiql({ endpointURL: "/graphql", })),
])
});
License
MIT
, see License file