Giter Club home page Giter Club logo

webtacular / fastify-hotql Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sirsavary/fastify-graphql

1.0 0.0 0.0 371 KB

This plugin is a fast and easy way to add GraphQL support to your Fastify application. It also includes support for hot reloading of schemas and resolvers, so you can keep your application up to date with the latest changes without having to restart your server.

Home Page: https://www.npmjs.com/package/fastify-hotql

License: MIT License

TypeScript 100.00%
graphql fastify node apollo apollo-server apollographql

fastify-hotql's Introduction

fastify-hotql

npm

A plugin for Fastify that adds GraphQL and GraphiQL support, and hot reloading of schemas and resolvers.

History

This project was forked from fastify-apollo as it is no longer being maintained fast enough to keep pace with the rapid changes happening in the GraphQL ecosystem.

And now, this project was forked from from jeromemacias, This is 4 years old and dosent work anymore.

Installation

# Yet to be uploaded
npm install --save fastify-hotql

Usage

import { buildSchema } from 'graphql';
import fastify from "fastify";
import hotQL from 'fastify-hotql';

const app = fastify();

// Initialize hotQL
const gql = new hotQL(app, {
  prefix: '/graphql',

  // You can start graphiql by setting this to true
  // PS: The paramaters below are optional
  graphiql: true,
  graphiql_prefix: '/graphql/explore',
  graphiql_endpoint: '/graphql/explore',
});

// Or you can do this later on the fly
gql.startGraphiQL({
  // PS: Both of these are optional
  prefix: '/graphql/explore',
  endpoint: '/graphql/explore',
});

// And for some reason, you can reload the schema and rootValues
// without having to restart the server
gql.reload();

// Start the server
app.listen(80).then(() => {
  console.log(`server listening on http://localhost:80`);
})

// Add a schema and rootValue to the hotQL instance
// You can do this before we start the server or after
const helloWorld = gql.addSchema(buildSchema(`
  type Query {
      hello: String
  }`,
  { hello: () => 'Hello World!' }
);

// You can also remove a schema
helloWorld.remove();

// You can get the hash of the schema
helloWorld.hash();

// You can get the rootValue
helloWorld.rootValue();

// And you can get the schema
helloWorld.schema();

fastify-hotql's People

Contributors

grzegorzmaniak avatar jeromemacias avatar rstacruz avatar sirsavary avatar wtgtybhertgeghgtwtg avatar

Stargazers

 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.