Coder Social home page Coder Social logo

ekosz / mercurius Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mercurius-js/mercurius

0.0 0.0 0.0 822 KB

Implement GraphQL servers and gateways with Fastify

Home Page: https://mercurius.dev/

License: MIT License

JavaScript 97.45% HTML 0.40% Shell 0.10% TypeScript 2.05%

mercurius's Introduction

mercurius

CI workflow

Mercurius is a GraphQL adapter for Fastify

Features:

  • Caching of query parsing and validation.
  • Automatic loader integration to avoid 1 + N queries.
  • Just-In-Time compiler via graphql-jit.
  • Subscriptions.
  • Federation support.
  • Federated subscriptions support.
  • Gateway implementation, including Subscriptions.
  • Batched query support.
  • Customisable persisted queries.

Docs

Install

npm i fastify mercurius graphql
# or
yarn add fastify mercurius graphql

The previous name of this module was fastify-gql (< 6.0.0).

Quick Start

'use strict'

const Fastify = require('fastify')
const mercurius = require('mercurius')

const app = Fastify()

const schema = `
  type Query {
    add(x: Int, y: Int): Int
  }
`

const resolvers = {
  Query: {
    add: async (_, { x, y }) => x + y
  }
}

app.register(mercurius, {
  schema,
  resolvers
})

app.get('/', async function (req, reply) {
  const query = '{ add(x: 2, y: 2) }'
  return reply.graphql(query)
})

app.listen(3000)

Examples

Check GitHub repo for more examples.

Acknowledgements

The project is kindly sponsored by:

The Mercurius name was gracefully donated by Marco Castelluccio. The usage of that library was described in https://hacks.mozilla.org/2015/12/web-push-notifications-from-irssi/, and you can find that codebase in https://github.com/marco-c/mercurius.

License

MIT

mercurius's People

Contributors

admataz avatar airhorns avatar aldis-ameriks avatar dependabot-preview[bot] avatar dependabot[bot] avatar frikille avatar greenkeeper[bot] avatar gtolarc avatar hw13 avatar iviaks avatar jemikanegara avatar john-behan avatar jonnydgreen avatar kidqueb avatar leorossi avatar mafintosh avatar mcollina avatar mrazauskas avatar natesilva avatar nigelhanlon avatar pabloszx avatar pacodu avatar paolochiodi avatar proti avatar pscarey avatar psteinroe avatar rafaelgss avatar simoneb avatar skellla avatar yndc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.