/graphql-practice

Repository created to record my practice learning GraphQL

Primary LanguageJavaScriptMIT LicenseMIT

GraphQL Practice Repo GraphQL Practice

Repository created to record my practice learning GraphQL with exercises based on the Udemy Course of Andrew Mead and Apollo GraphQL - Fullstack Tutorial.

Table of contents

Status

  • Current repo's version is GraphQL practice version
  • This course has been completed on 26/01/2022 - Certificate

Why it has not any updated dependencies?

After finishing its related Udemy course, I archive this repository and unarchive it when I start a new training and add a link in the Other practice repos section referring to its new repo. But I don't update any associated dependency due to technology changes during the years between each practice, and the produced code which works with the mentioned requirements.

Requirements

  • Node v16.13.2 or above
  • A relational database (like PostgreSQL or MySQL, for example) (for 3-prisma)
  • pgAdmin or any relational database client (for 3-prisma)

Repo structure

  • 1-exercises: Exercises related to Andrew's course.
  • 2-apollo: Server and Client projects from Apollo's Tutorial to understand an end to end implementation.
  • 3-prisma: Prisma learning and integration with a GraphQL server.
  • 4-testing: How to create and run unit tests for a GraphQL server

Setup

After cloning the repo, go to the created folder and install the node packages.

git clone https://github.com/NicolasOmar/graphql-practice.git
cd graphql-practice
npm run setup-all

setup-all is the command to install all the projects, but if you want to do it one by one, you can change that last line for one of the following:

App Setup Command
All npm run setup-all
Exercises npm run setup-exercises
Apollo tutorial npm run setup-apollo
Prisma exercises npm run setup-prisma
Unit testing npm run setup-testing

What did I learn?

  • Set and run a server using a minimum configuration
    • How to set typeDefs and resolvers
  • Understanding of Scalar and Custom Types
  • How to make a Query
    • Structure the operator to be called
    • Make calls for deep-level objects
    • Make calls using operators and configure it through a resolver
    • Understanding, and configuration of Relational data through Types
  • How to make a Mutation
    • Configure Input Types to improve readability in Mutation operators
  • How to make a Subscription
  • Structure a good folder structure
    • Creation of a Schema file to hold created Types (Queries, Mutation, Subscriptions, and Custom Types)
    • Split different Resolvers into files by Operation type or Entity
  • How to make CRUD operations (CREATE, READ, UPDATE & DELETE) to a SQL-based database using Prisma
    • Understand how to map the database config using prisma db pull && prisma generate
    • How to use its special annotations in the schema.prisma file
    • How to make changes to the database using prisma db push
    • Integrate the tool in a Node/GraphQL server
    • Hash and compare hashed passwords using bcrypt
    • Create JWT and verify tokens using jsonwebtoken
    • Paginate results by using take and skip properties in queries
    • Sort the results by using orderBy and order
  • How to create and run unit test cases by using Jest
    • Run an Apollo GraphQL client for plain Javascript with apollo-boost and cross-fetch
    • Create a fake database on the fly using faker
    • Build a site with pure HTML with parcel

Other practice repos

Node React Angular Typescript HTML & CSS Styling Docker Next.js
Node Practice Repo React Practice Repo Angular Practice Repo Typescript Practice Repo HTML and CSS Practice Repo Styling Practice Repo Docker Practice Repo Next.js Practice Repo