Giter Club home page Giter Club logo

the-road-to-graphql's Introduction

The Road to GraphQL [Book]

Slack

Official repository for The Road to GraphQL. If you want to leave a review, please do it on Amazon or Goodreads.

Translations of the book into Github

The Road to GraphQL is also available in other languages. Thanks for all translators for their awesome work!

Updates, Help and Support

Contribute

You can help to improve the book by opening Issues and Pull Requests (PR).

You can open up any PR that corrects spelling or explains a certain lesson with more detail. When writing such a technical book, you get fast blind on what needs more explanation and on what is already explained well.

In addition, you can open Issues when you run into problems. In order to make the fix for the Issue as easy as possible, please provide a couple of details such as error log, screenshot, which page of the book it happened, your node version (command line: node -v) and a link to your own repository. Not all of these details are mandatory, but most of them help to fix the Issue and to improve the book.

Thanks a lot for your help!

the-road-to-graphql's People

Contributors

alivenotions avatar ceoehis avatar emmanuelstalling avatar lcnogueira avatar nadgerz avatar palerdot avatar rwieruch avatar ugultopu avatar unamaria avatar vondervuflya avatar wgcrouch avatar

Stargazers

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

Watchers

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

the-road-to-graphql's Issues

Getting the Token but not the last copy of it

Following the tutorial from the book and I'm facing an issue:

I'm able to generate the Token and everything but, when i run this code, looks like the token isn't passed to the apolloServer at the same time:

const getMe = async req => {
const token = req.headers['x-token'];
if (token) {
try {
return await jwt.verify(token, process.env.SECRET);
} catch (e) {
throw new AuthenticationError(
'Your session expired. Sign in again.',
);
}
}
};

tried to debug this thing, and I sent the token to the console and when the localStorage is empty and try to authenticate a user the TOKEN is generated in the localstorage fine, but in the ApolloServer i have null

then i try again to authenticate and i found that the Token is passed to the ApolloServer but is passing the old token, so i'm getting the message 'Your session expired. Sign in again.', all the time

Clarify HTTP Headers in Playground

Hi Robin,
Just small suggestion in the Setting Headers in GraphQL Playground section in your book, “The Road to GraphQL”.
I was not very clear how to include “x-token” into the mutation delete user request,
because I am new to GraphQL Playground, It would be nice if you have info like
“Notice there is a text area called HTTP HEADERS at the bottom of the playground and
paste your “x-token” there.
Thank you for your work. It is awesome book!!!
After reading this book, I should able to write my Apollo GraphQL and client.
Kieu

GraphQL Server: bcrypt vs bcrypt.js

If you run into any problems with bcrypt on Windows while installing it, you can try out a substitute called bcrypt.js. It is slower, but people reported that it works on their machine.

Add Section Dropdowns In Sidebar Menu Items

Navigating the sections in each sidebar menu option is cumbersome. Adding dropdowns with links to each section, like was done in the Road To React, would make the course a lot easier to navigate. This is not a bug, just a feature request.

Steps to reproduce

  1. Go to https://courses.robinwieruch.de/p/the-road-to-graphql
  2. In the left sidebar menu click Apollo Server to open the page.
  3. Notice that there is no dropdown menu with links to each of Apollo Server's sections.

Desired Result

The Apollo Server sidebar menu option contains a dropdown with links to each of the following 'Apollo Server' sections:

Node.js with GraphQL and Apollo Server
Apollo Server Setup with Express
Apollo Server: Type Definitions
Apollo Server: Resolvers
Apollo Server: Type Relationships
Apollo Server: Queries and Mutations
GraphQL Schema Stitching with Apollo Server
  Technical Separation
  Domain Separation
PostgreSQL with Sequelize for a GraphQL Server
Connecting Resolvers and Database
Apollo Server: Validation and Errors
Apollo Server: Authentication
  Registration (Sign Up) with GraphQL
  Securing Passwords with Bcrypt
  Token based Authentication in GraphQL
  Login (Sign In) with GraphQL
Authorization with GraphQL and Apollo Server
  GraphQL Authorization on a Resolver Level
  Permission-based GraphQL Authorization
  Role-based GraphQL Authorization
  Setting Headers in GraphQL Playground
GraphQL Custom Scalars in Apollo Server
Pagination in GraphQL with Apollo Server
  Offset/Limit Pagination with Apollo Server and GraphQL
  Cursor-based Pagination with Apollo Server and GraphQL
  Cursor-based Pagination: Page Info, Connections and Hashes
GraphQL Subscriptions
  Apollo Server Subscription Setup
  Subscribing and Publishing with PubSub
Testing a GraphQL Server
  GraphQL Server E2E Test Setup
  Testing User Scenarios with E2E Tests
Batching and Caching in GraphQL with Data Loader
GraphQL Server + PostgreSQL Deployment to Heroku

Actual Results

All sections are located on a single page. It takes quite a while to scroll through all the sections and makes it not very easy to navigate.

Feedback by Abhi

Abhi 11:35 AM
thanks @rwieruch, i planned on going through the book from start to finish, but half way through decided to do the backend first, which i would suggest, as you know exactly what you are building, and its goes with the graphql philosophy of schema first development

rwieruch 11:36 AM
yeah, that’s what I expected. the frontend stuff is perhaps too much with developing two GitHub applications. I keep this in mind for the next edition!

Balraj 11:37 AM
joined #graphql.

Abhi 11:40 AM
waiting eagerly! also, i used https://graphql-code-generator.com/ this library to generate hooks for all operations, it does it in typescript, create-react-app, so i mixed js and ts. my next goal is to build it completely in ts

Unnecessary use of function version of React's setState method

On pages 54, 62 and 63, a function with no arguments is passed to React's setState method:

this.setState(() => ({
  organization: result.data.data.organization,
  errors: result.data.errors,
}));

This is needless because the previous state is not being used when setting up the next state. That is, the code could have simply been:

this.setState({
  organization: result.data.data.organization,
  errors: result.data.errors,
});

Because of this usage in pages 54, 62 and 63, resolveIssuesQuery on page 64 returns a function instead of simply returning an object. That is, resolveIssuesQuery is:

const resolveIssuesQuery = queryResult => () => ({
  organization: queryResult.data.data.organization, 
  errors: queryResult.data.errors,
});

instead of simply:

const resolveIssuesQuery = queryResult => ({
  organization: queryResult.data.data.organization, 
  errors: queryResult.data.errors,
});

Fix typos/grammar - online book - chapter React With GraphQL

I found a few typos / grammatical issues in the React With GraphQL chapter in the GraphQL online book. I hope these help.

Steps To Reproduce

  1. Go to https://courses.robinwieruch.de/p/the-road-to-graphql
  2. Go to section Book Online -> React With GraphQL
  3. Search for the following sentences and notice the spelling/grammatical errors in the sentences.

Actual Result

  1. The function that is passed to this.setState() can be extracted as higher-order function.
  2. Note that the application is not built for to be robust, but is intended only as a learning experience.
  3. Remember to adjust the name of the query variable when its used to perform the request.
  4. Remember, a query reaches into the GraphQL graph, so we can nest the repository field in the organization when the schema defined the relationship between these two entities.
  5. In the previous template string, the cursor is passed as variable to the query and used as after argument for the list field.
  6. That's not all by a long shot, so stay tuned for the next applications you are are going to build with GraphQL.

Expected Result

  1. The function that is passed to this.setState() can be extracted as a higher-order function.
  2. Note that the application is not built to be robust, it is intended only as a learning experience.
  3. Remember to adjust the name of the query variable when it's used to perform the request.
  4. Remember, a query reaches into the GraphQL graph, so we can nest the repository field in the organization when the schema defines the relationship between these two entities.
  5. In the previous template string, the cursor is passed as variable to the query and used as an argument for the list field.
  6. That's not all by a long shot, so stay tuned for the next applications you are going to build with GraphQL.

Typo on page 11

Instead of:

Finding the right solution for a given problem is not always simple, and web applications build with GraphQL are a good example of how changing times make for constantly evolving challenges.

The right one:

Finding the right solution for a given problem is not always simple, and web applications built with GraphQL are a good example of how changing times make for constantly evolving challenges

Sorry 😊

[PDF/Online Book] Typo on Introduction, First Paragraph

PDF Book Version

[...] Facebook, the company behind the GraphQL specification, released GraphQLâ€TMs [...]

Book Online Version
[...] Facebook, the company behind the GraphQL specification, released GraphQLâ€TMs [...]

Add functional component examples in addition to class components

It would be a major benefit to add React functional components as examples to the current Road to GraphQL chapters.

This would increase the speed of students comprehension of both React and GraphQL. It would also increase the value of the GraphQL book.

Current state

Book examples are written using Class components.

Expected state

Book examplesare written with both Class and Functional components.

Author benefits

  • Increased sales and earnings
  • Increased marketability

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.