Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ricardo-valero/graphql-voyager-fastify-plugin
A fastify plugin for graphql voyager
https://github.com/ricardo-valero/graphql-voyager-fastify-plugin
Last synced: 10 days ago
JSON representation
A fastify plugin for graphql voyager
- Host: GitHub
- URL: https://github.com/ricardo-valero/graphql-voyager-fastify-plugin
- Owner: ricardo-valero
- License: gpl-3.0
- Created: 2021-07-06T22:49:38.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-15T15:47:32.000Z (about 3 years ago)
- Last Synced: 2024-11-29T13:34:57.312Z (27 days ago)
- Language: TypeScript
- Size: 45.9 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# graphql-voyager-fastify-plugin
[![npm](https://img.shields.io/npm/v/graphql-voyager-fastify-plugin.svg)](https://www.npmjs.com/package/graphql-voyager-fastify-plugin)
This is a [**Fastify Plugin**](https://www.fastify.io/docs/master/Plugins/) for hosting an instance of [**GraphQL Voyager**](https://github.com/APIs-guru/graphql-voyager), with support for **TypeScript**, and tested for **Fastify v3**.
## Install
```sh
npm install graphql-voyager-fastify-plugin
```## Usage
```ts
import fastify from 'fastify'
import GraphQLVoyagerFastify from 'graphql-voyager-fastify-plugin'const app = fastify()
// ...
app.register(GraphQLVoyagerFastify, {
/**
* All these are the defaults.
*/
// url path
path: '/voyager',
// graphql endpoint path
endpoint: '/graphql'
});// ...
// Voyager available at localhost:3000/voyager
app.listen(3000);
```## References
Heavily based on [Altair](https://github.com/altair-graphql/altair) Fastify Plugin and this [repo by bdatdo0601](https://github.com/bdatdo0601/graphql-api-starter/blob/master/src/plugins/voyager/index.js).
To publish to npm I read this [guide](https://cameronnokes.com/blog/the-30-second-guide-to-publishing-a-typescript-package-to-npm/) and this other [guide](https://itnext.io/step-by-step-building-and-publishing-an-npm-typescript-package-44fe7164964c).
## Contributors
* Olivier Refalo: I am not ready to switch to graphql-ez, adjusted this experiment and made it work with the CDN version of graphql-voyager