↓ Ir para o conteúdo principal

← todas as notas

📎 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 typeDefs and resolvers.
  • It explains that schemas live in typeDefs, and that GraphQL root operations are Query, Mutation, and Subscription.
  • It says resolvers are functions that compute values for schema fields and handle fetching, creating, and business logic.
  • It creates a simple sayHello query and a matching resolver that returns a string.
  • It adds a fake DAILY_TASKS array to simulate a database for CRUD examples.
  • It defines a Tasks type, a fetchTasks query, and later adds filtered fetching plus addTask and updateTask mutations.
  • It states that ! in the schema marks a required field.
  • It lists resolver arguments as root, args, context, and info, and says the demo mainly uses args.
  • 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.