Skip to content

Latest commit

 

History

History
101 lines (80 loc) · 1.79 KB

File metadata and controls

101 lines (80 loc) · 1.79 KB

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.