GraphQL
- Automated Types Generation (TS) *https://www.apollographql.com/blog/tooling/apollo-codegen/typescript-graphql-code-generator-generate-graphql-types/ import type { Tag } ./generated;
- GraphQL Studio (interactive schema explorer) - https://www.apollographql.com/docs/apollo-server/getting-started
- Alternative to Apollo: https://github.com/IvanGoncharov/graphql-voyager
- Resolvers (connect client fields w/ backend fields) https://www.apollographql.com/docs/apollo-server/data/resolvers
query GetAllAuthors {
author {
id
name
}
}
Performance Problems
Countries and Cities table. (1:n)
GQL Standard flow: 1- fetch all countries 2- for each country cities, lookup/join each city
Total amount of queries: 1+c1+c2+...cn
GQL Data Loader Flow: 1- fetch all countries 2- Get all cities
Total amount of queries: 1+x
======================================================================================================================== REST
- API Explorer: https://github.com/samundrak/expressjs-api-explorer
- Swagger UI (API Explorer alternative)
Routes /authors /authors/:id/posts /authors/:id/posts/:post_id/comments
Created on 8/16/2022