Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/simoneb/graphql-sse-mercurius

Example showing how to use graphql-sse with Mercurius.
https://github.com/simoneb/graphql-sse-mercurius

example fastify graphql graphql-sse mercurius sse

Last synced: 26 days ago
JSON representation

Example showing how to use graphql-sse with Mercurius.

Awesome Lists containing this project

README

        

# graphql-see-mercurius

Example showing how to use graphql-sse with Mercurius.

It builds on top of https://www.the-guild.dev/blog/graphql-over-sse#with-fastify and adds mercurius to the picture, with minor adaptations.

## Requirements

- Node LTS

## Setup

- `npm i`
- `node server.js`

In a different terminal window run:

- `node client.js`

This will check that queries and subscriptions work over plain HTTP (mercurius) and SSE (graphql-sse)

## How it works

- Exposes the same schema both via mercurius and graphql-see
- Mercurius listens on path `/graphql` whereas graphql-see on `/graphql-stream`
- Any GraphQL operations can go to either one or the other