Code Monkey home page Code Monkey logo

graphql-book's Introduction

graphql-book

See: https://api-university.com/books/graphql-api-design/tutorial/

Setup

  • Install npm
    • Check installation npm -v
      • If not found: brew install npm
      • If version printed: brew upgrade npm
  • Install node.js
    • Check installation node -v
      • If not found: brew install node
      • If version printed: brew upgrade node
  • Download the tutorial sources, go to the directory and fetch the dependencies:
    • npm install -save graphql express graphql-server-express body-parser graphql-tools graphql-subscriptions subscriptions-transport-ws

Run

In order to run the server, simply execute npm start which should print out the following:

> [email protected] start /Users/cpickl/Dev/graphql-book
> node ./server.js

GraphQL on port 4000

The address http://localhost:4000/ should return a simple "Hello World!", whereas the well-known GraphiQL is available at: http://localhost:4000/graphiql

Client

Point your browser to http://localhost:4001/client.html to run a sample client.

Sample queries

Read all books:

query readAllBooks {
  books {
    id
    title
    authors {
      id
      name
    }
  }
}

Read a single book:

query readBook {
  book(title: "ReSTful Services") {
    id
    title
  }
}

graphql-book's People

Watchers

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