GithubHelp home page GithubHelp logo

all2pie / mercurius Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mercurius-js/mercurius

0.0 0.0 0.0 1.06 MB

Implement GraphQL servers and gateways with Fastify

Home Page: https://mercurius.dev/

License: MIT License

JavaScript 97.63% HTML 0.30% Shell 0.08% TypeScript 1.99%

mercurius's Introduction

Mercurius Logo

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

mcollina avatar dependabot[bot] avatar pacodu avatar greenkeeper[bot] avatar jonnydgreen avatar frikille avatar pabloszx avatar aldis-ameriks avatar eomm avatar skellla avatar sameer-coder avatar dependabot-preview[bot] avatar psteinroe avatar iviaks avatar leorossi avatar pscarey avatar rafaelgss avatar brainrepo avatar simoneb avatar wiktor-obrebski avatar chemicalkosek avatar john-behan avatar capaj avatar jemikanegara avatar yndc avatar temsa avatar tomi-bigpi avatar puchm avatar mrazauskas avatar simenb 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.