Giter Club home page Giter Club logo

graphql-hemera's Introduction

What is GraphQL?

GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.

preview

What is Hemera?

Hemera is a microservice toolkit based on the NATS Server. You can use efficient pattern matching to have the most flexibility in defining your RPC's. It doesn't matter where your server or client lives. With Hemera you can create microservices without to worry about all the different aspects in a distributed system like routing, load-balancing, service-discovery, clustering, health-checks ...

This setup demonstrate how to use Hemera for resolving your GraphQL queries. Because of the flexibility of GraphQL you have to deal with many resolvers hemera can provide you a way to manage this in a very simple and flexible way. Combine GraphQL with the power of pattern matching.

Show me

Resolver

const resolvers = (hemera) => ({
  Query: {
    getUserById (root, { id }) {
      return hemera.act({
        topic: 'user',
        cmd: 'getUserById',
        id
      })
    },
    ...

Implementation: Can be hosted anywhere

  hemera.add({
    topic,
    cmd: 'getUserById',
    id: Joi.number().required()
  }, function (req, reply) {
    const matchedUser = users.filter(x => x.id === req.id)
    reply(null, matchedUser.length ? matchedUser[0] : null)
  })

Getting started

npm install
npm run start

GraphiQL Dashboard

http://localhost:3000/graphiql

GraphQL endpoint

http://localhost:3000/graphql

graphql-hemera's People

Contributors

starptech avatar

Watchers

 avatar  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.