0.2.0 • Published 3 years ago

next-graphql-handler v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

next-graphql-handler

WIP project to create a GraphQL API route that can be used to handle GraphQL queries and mutations.

Quickstart

import { GraphQLHandler } from "next-graphql-handler";

const typeDefs = `
  type Query {
    hello: String
  }
`;

const resolvers = {
  Query: {
    // hello: (_, __, { userId }) => `context passed: ${userId}`,
    hello: () => "world",
  },
};

export default GraphQLHandler({
  typeDefs,
  resolvers,
  // context: (req) => ({
  //   userId: req.headers.authorization,
  // }),
});

Todos

  • [] Allow object OR func for context
  • [] Enable directives
  • [] Add tests
0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago