Skip to content

GraphQL project boilerplate based on Koa.js, TypeScript and Apollo Server

Notifications You must be signed in to change notification settings

rrd-fe/koa-graphql-starter

Repository files navigation

koa-graphql-starter

GraphQL project boilerplate based on Koa.js, TypeScript and Apollo Server

We're using the official apollo-server-koa.

Features

Demo App

To illustrate the result of this boilerplate, we are creating an online E-commerce App, which has the following entities: Product, User, Order. The schema definitions are like this:

type Product {
    productId: ID!
    name: String!
    img: String!
    price: Int!
}
type User {
    userId: ID!
    name: String!
    age: Int!
    orders: [Order]
}
type Order {
    orderId: ID!
    product: Product!
    user: User!
    # the number of the product
    num: Int!
    # timestamp when order created
    createAt: Int
}

Following is Query and Mutation:

Query {
    productList: [Product]!
    productDetail: Produce
    me: User
}
Mutation {
    login(name: String!, password: String)
    buy(productId: ID!, num: Int!): Order
}

About

GraphQL project boilerplate based on Koa.js, TypeScript and Apollo Server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published