Giter Site home page Giter Site logo

nodejs-graphql-subscriptions-boilerplate's Introduction

Boilerplate to test GraphQL subscriptions using nodejs

Although it takes just a few lines of code to set up your NodeJS code to use GraphQL subscriptions, it does involve going through a few pages of docs. We've put together a few lines of boilerplate code to make it easy to get started.

Usage:

  • Reference code: Refer to index.js for the boilerplate code that sets up a GraphQL subscription observable.

  • Dependencies: This uses the apollo link, subscription-transport-ws libraries. npm install --save graphql graphql-tag apollo-link apollo-link-ws subscriptions-transport-ws ws

Try it out:

  • Use hasura as a test backend: Deploy to Heroku
  • Create a table author with columns id: integer, name: text
  • Set the GraphQL endpoint in index.js to https://HEROKU_APP_NAME.herokuoapp.com/v1alpha1/graphql
  • git clone https://github.com/hasura/nodejs-graphql-subscriptions-boilerplate.git
  • cd nodejs-graphql-subscriptions-boilerplate
  • npm i
  • node index.js
  • Now head to the Hasura console and insert an author with id: 1, name: honeysingh
  • Changes will appear on your nodejs code
  • Edit the row on the console
  • Changes will appear on your nodejs code

nodejs-graphql-subscriptions-boilerplate's People

Contributors

coco98 avatar karthikvt26 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

coco98

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.