Tutorial

The tutorial assumes that you're familiar with ES2015 concepts like computed keys, arrow functions, and template literals.

In this tutorial, we're going to create two JavaScript classes: User and Blog, and five files: schema.js, queries.js, mutations.js, middleware.js, and the index.js entry file. Then, we'll use them to compile a GraphQLSchema and plug it into express-graphql. The tutorial assumes that you have an empty, npm project already initialized.

mkdir models
touch index.js schema.js queries.js mutations.js middleware.js models/User.js models/Blog.js
  1. Define your business-logic layer
  2. Define your schema
  3. Root queries and mutations
  4. Middleware
  5. Wire everything together

If you don't really care for tutorials and just want to see some code, you can check out some examples.

results matching ""

    No results matching ""