https://github.com/rodneylab/fastify-mercurius-nexus-graphql-api
GraphQL API demo using Fastify, Mercurius and Nexus
https://github.com/rodneylab/fastify-mercurius-nexus-graphql-api
api docker docker-compose fastify graphql graphql-api mercurius nexus postgresql prisma typescript uvu
Last synced: 18 days ago
JSON representation
GraphQL API demo using Fastify, Mercurius and Nexus
- Host: GitHub
- URL: https://github.com/rodneylab/fastify-mercurius-nexus-graphql-api
- Owner: rodneylab
- License: bsd-3-clause
- Created: 2022-07-28T13:34:58.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-03T18:09:50.000Z (3 months ago)
- Last Synced: 2025-04-04T10:04:49.244Z (about 1 month ago)
- Topics: api, docker, docker-compose, fastify, graphql, graphql-api, mercurius, nexus, postgresql, prisma, typescript, uvu
- Language: TypeScript
- Homepage:
- Size: 535 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
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.```shell
pnpm run dev
```To test a GraphQL query, navigate to
[http://localhost:4000/graphiql](http://localhost:4000/graphiql) in your browser.## Run Tests
Stop the dev server then run
```shell
pnpm test
```You can add additional tests under the `tests` folder.
## Test queries
### Queries
```graphql
{
drafts {
id
title
body
published
}
}
``````graphql
query {
posts {
id
title
body
published
}
}
```### Mutations
```graphql
mutation {
createDraft(title: "Nexus", body: "...") {
id
title
body
published
}
}
``````graphql
mutation {
deleteDraft(draftId: 1)
}
``````graphql
mutation {
publish(draftId: 1) {
id
title
body
published
}
}
```Feel free to jump into the
[Rodney Lab matrix chat room](https://matrix.to/#/%23rodney:matrix.org).