In this demo we will build a Node.JS server, connect it to Prisma and implement all sorts of resolvers by using prisma bindings.
# Clone the repo
git clone https://github.com/Makazone/graphqleu-2018-ws gql-eu-demo3
# Cd into it and instal deps
cd gql-eu-demo3 && yarn && yarn start
The demo consists of multiple steps. Each step is in a separate branch. You can peak (or check the solution) by doing a git checkout
.
- master - basic GraphQL server with in-memory DB
- prisma-init - the starting point to integrate prisma
- prisma-resolvers - prisma is integrated, time to write some resolvers
- finish - implemented resolvers
Here we have a simple GraphQL Server with an in-memory DB. It uses graphql-yoga.
query {
posts(searchString: "QL") {
id
title
content
published
}
}
query {
post(id: "post-0") {
id
title
content
published
}
}
mutation {
createDraft(
title: "GraphQL Bindings"
content: "Reuse and compose GraphQL APIs"
) {
id
published
}
}
mutation {
publish(id: "post-0") {
id
published
}
}
mutation {
deletePost(id: "post-0") {
id
title
content
published
}
}