Changes from Mirella
This PoC was created in order to figure out GraphQL combined with Apollo.
Make sure you add an .env
file at the root of the project with a "themoviedb.org" API key in this format: API=xxxxxxx
.
Team developers can find a shared key here.
- Run the server using
npm run server
. (the schema.json generator uses this server) - Run the command to generate the schema.json and the Typescript file:
npm run generate-types
GraphQL is only a specification
The best tutorial out there to get started (link)
- Schema
- Collection of GraphQL types
- Contract between client and server
- Mutations (Create, update, delete data) (link)
- Subscriptions (Real time updates)
- Resolver functions (??)
2 major GraphQL clients
Relay Modern:
- Very opinionated structure and naming convention (src)
- Takes a little more development time (src)
- Works well with React Native (src)
Apollo:
No need to worry about low-level networking tasks (fetch functions), all you need to do with GraphQL is write a query where you declare your data requirements.
GraphQL clients use the concept of higher-order components to fetch the needed data under the hood and make it available in the props
of your components.