Skip to content

Latest commit

 

History

History
57 lines (44 loc) · 828 Bytes

README.md

File metadata and controls

57 lines (44 loc) · 828 Bytes

apollo-server-micro-boilerplate

Getting started with GraphQL on apollo-server-micro 🚀

Installation

$ git clone https://github.com/shoNagai/apollo-server-micro-boilerplate.git
$ cd apollo-server-micro-boilerplate
$ yarn install
$ yarn dev

step1 schema design

type Book {
  id: ID!
  title: String!
  author: String!
}
type Query {
  books: [Book!]!
}

step2 generate types

$ yarn generate
src/types/graphql.ts

step3 create a resolver

import mockData from '../mocks/book.json';
import { Resolvers } from '../types/graphql';

export const resolvers: Resolvers = {
  Query: {
    books: () => mockData,
  },
};

step4 try playground

$ yarn dev

playground