📎 Webclip
How to Get Started With a Graph QL, React, Apollo Client, and Apollo Server App
The article is a two-part series. Part one explains what GraphQL is, contrasts it with REST and SOAP, and builds a small backend with Apollo Server. Part two is said to cover integrating that GraphQL backend with a React frontend using Apollo Client.
Reading notes#
- It defines GraphQL as a specification for data exchange between server and client over HTTP, and as a query language for APIs.
- It contrasts GraphQL with REST by saying GraphQL lets the client ask for only the data needed for a page.
- It introduces Apollo Server and Apollo Client as the tools used in the demo.
- It sets up a simple project structure with backend and frontend in the same folder.
- It shows an Apollo Server initialized with
typeDefsandresolvers. - It explains that schemas live in
typeDefs, and that GraphQL root operations areQuery,Mutation, andSubscription. - It says resolvers are functions that compute values for schema fields and handle fetching, creating, and business logic.
- It creates a simple
sayHelloquery and a matching resolver that returns a string. - It adds a fake
DAILY_TASKSarray to simulate a database for CRUD examples. - It defines a
Taskstype, afetchTasksquery, and later adds filtered fetching plusaddTaskandupdateTaskmutations. - It states that
!in the schema marks a required field. - It lists resolver arguments as
root,args,context, andinfo, and says the demo mainly usesargs. - It shows resolver logic for reading all tasks, adding a task, and updating a task in the fake array.
- It closes by saying part two will use React and Apollo Client to build the frontend and consume the APIs created here.
