Skip to content

rodneylab/fastify-mercurius-nexus-graphql-api

Folders and files

NameName
Last commit message
Last commit date
Aug 14, 2023
May 3, 2024
May 3, 2024
Feb 3, 2025
Aug 17, 2022
Jul 30, 2022
Aug 14, 2023
Aug 17, 2022
Aug 17, 2022
Aug 17, 2022
Jul 30, 2022
Feb 3, 2025
Aug 14, 2023
Jan 3, 2023
Feb 3, 2025
Jul 28, 2022
Feb 3, 2025
Feb 3, 2025
Jul 30, 2022
Feb 3, 2025
Feb 3, 2025
Jul 30, 2022
Jul 30, 2022
Jul 30, 2022

Rodney Lab fastify-mercurius-nexus-graphql Github banner

Rodney Lab logo

Fastify Mercurius Nexus GraphQL

fastify-mercurius-nexus-graphql

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.

GraphQL API demo using Fastify, Mercurius and Nexus

Run Development Server

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.

Run Tests

Stop the dev server then run

pnpm test

You can add additional tests under the tests folder.

Test queries

Queries

{
	drafts {
		id
		title
		body
		published
	}
}
query {
	posts {
		id
		title
		body
		published
	}
}

Mutations

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.