Giter Site home page Giter Site logo

graphql's Introduction

GraphQL (created by Facebook)

New API standard

Alternative to REST

  1. More Efficient (no over/underfetching - less unused data and endpoints)
  2. More Powerful
  3. More Flexible

Enables Declarative Data Fetching - Client can specify what data it needs from the API!

Only exposes ONE endpoint! (client uses queries)

Analytics - evolving API (removing unused features)

GraphQL uses strong type system (define API)

Advantages: Reduced data transfer (client asks only for the required information!)

GraphQL VS REST

Example BLOG app (w/ user name, user post, user followers)

REST - 3 Requests (to get the user name we will need to request a lot of needed data that is useless)

GraphQL - 1 Request (with all information)

Query

query {
    User(id: "iusfgh"){
        name
        posts{
            title
        }
        followers(last: 3){
            name
        }
    }
}

Return

{
    "data":{
        "User":{
            "name":"Joana",
            "posts":[...],
            followers:[...]
        }
    }
}

Refs:

https://github.com/graphql/graphiql https://www.prisma.io/blog/graphql-sdl-schema-definition-language-6755bcb9ce51 https://github.com/graphql/graphql-playground

Warning

Opened Issues: howtographql/howtographql#1471

Other Issues:

  1. howtographql/howtographql#1450
  2. howtographql/howtographql#1409
  3. howtographql/howtographql#1326

The official repo looks EOF

Personal Opinion:

The lack of standards on the specification is leading to different approaches.

Watch for: https://github.com/graphql-go/graphql

graphql's People

Contributors

mdmourao avatar

Watchers

 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.