Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Graphql workshop

Avatar for Aashima Ahuja Aashima Ahuja
September 18, 2024
5

Graphql workshop

GraphQL workshop React Alicante

Avatar for Aashima Ahuja

Aashima Ahuja

September 18, 2024
Tweet

Transcript

  1. Agenda 1. Introduction 2. Graphql fundamentals 3. Graphql Server 4.

    GraphQl Client (Apollo Client) 5. Graphql with typescript
  2. RESTful Routing They are set of rules that are used

    to carry out the CRUD operations, by using a set of HTTP verbs to make server requests.
  3. HTTP methods URL Method Operation /posts POST Create a new

    post /posts GET Fetch all posts /posts/23 GET Fetch post 23 /posts/20 PUT update post 20 /posts/12 DELETE delete post 12
  4. Restful conventions URL Method Operation /<name> POST Create a record

    /<name> GET Fetch all records /<name>/:id GET Fetch record with given id /<name>/:id PUT update record with given id /<name>/:id DELETE delete record with given id
  5. Nested Urls URL Method Operation /users/2/posts POST Create a new

    post /users/2/posts GET Fetch all posts users/2/posts/23 GET Fetch post 23 users/2/posts/20 PUT update post 20 users/2/posts/12 DELETE delete post 12
  6. Shortcomings of RESTful routing John Doe software engineer at Google

    Sarah Drasner software engineer at Netlify David Miller software engineer at X Cool Dude Fashion Designer @Tommy username company
  7. Tables userId ID name String company_id ID position_id ID id

    ID name String description String User Company id ID name String description String Position
  8. Friend Friend Friend Company Position Company Position Company Position /user/23/friends

    /users/1/company /users/1/position /users/2/company /users/2/position
  9. RESTful Routing shortcomings 1. Difficult to define urls in case

    of heavily nested relations 2. Too many http calls 3. Over Fetching data
  10. query { user(id: “23”) { friends { company name }

    } } User User User User Company Position Position Company Position
  11. Graphql academy - Display list of courses - Show details

    of each course - Add new course - Delete a course - Update details of a course