Code Monkey home page Code Monkey logo

thinking-in-graphql's Introduction

Thinking in GraphQL exercise

This repo contains some exercises to help you learn the following:

  • Thinking in Graphs
  • Setting up a GraphQL server using Express
  • GraphQL queries
  • Pagination using the Relay Cursor Connections specification

Exercise part 1

http://ec2-35-176-58-126.eu-west-2.compute.amazonaws.com:8080/graphiql

  • Query a list of courses
  • Query a single course by id
  • Query a single course by $id ($id is a variable)
  • How many courses in the system?
  • How many currencies in the system?
  • How many types do we have in the system?

Exercise part 2

Before Install

  • Make sure you have mongodb available & running
  • you can Install mongodb in your mac through brew

How to install

  • git clone [email protected]:leanjscom/thinking-in-graphql.git
  • cd thinking-in-graphql
  • create folders needed for your local mongodb database: mkdir data && mkdir data/db
  • mongod --dbpath=data/db
  • open in a separate shell the project folder and execute the following commands
  • yarn install or npm install
  • yarn start or npm start

Questions exercise part 2

  1. In src/server.js add graphqlExpress using https://github.com/apollographql/apollo-server#express.
  2. The field currency in Course type (src/graphql/types/course) should be of type CurrencyTypeEnum and should be non null.
  3. The course field in src/graphql/fields/course should have the id of the course as an argument
  4. Include the Voucher queries into src/graphql/fields/index.js
  5. Finish the implementation in the vouchers field in src/graphql/fields/voucher.js
  6. Fix the resolver in the voucher field in src/graphql/fields/voucher.js
  7. The voucher type (src/graphql/types/voucher.js) should have a field called course that should return the course of that voucher. You should be able to do this https://goo.gl/ffGsDo
  8. The course type (src/graphql/types/course.js) should have a field called vouchers that should resolve to a relay connection with all the vouchers of that course. You should be able to do this https://goo.gl/PfRF4K

Further reading

License

This material is available for private, non-commercial use under the GPL version 3.

thinking-in-graphql's People

Contributors

alexlobera avatar ric9176 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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