Demo for Node GraphQL API using Fastify, TypeScript, Mercurius and Nexus. The code accompanies the article on Fastify GraphQL API Stack. If you have any questions, please drop a comment at the bottom of that page.
Copy .env.dev.EXAMPLE
and .env.test.EXAMPLE
to .env.dev
and .env.test
and update docker-compose.yml
with your own credentials.
pnpm run dev
To test a GraphQL query, navigate to http://localhost:4000/graphiql in your browser.
Stop the dev server then run
pnpm test
You can add additional tests under the tests
folder.
{
drafts {
id
title
body
published
}
}
query {
posts {
id
title
body
published
}
}
mutation {
createDraft(title: "Nexus", body: "...") {
id
title
body
published
}
}
mutation {
deleteDraft(draftId: 1)
}
mutation {
publish(draftId: 1) {
id
title
body
published
}
}
Feel free to jump into the Rodney Lab matrix chat room.