An API is the agreed interface and data format through which an application exchanges requests and responses with a server. Remote reads and writes depend on server responses, unlike access to locally stored data. section 9.2.2 section 9.2.2
A RESTful CRUD API organizes requests around resources:
- Treat requests as stateless and resource-centric. section 9.2.2
- Support resource operations such as create, read, update, and delete where they make sense. section 9.2.2
- For example, a goal-tracking service can expose session, user, and things endpoints. section 9.2.2
Coordinate geocoding
A client sends latitude and longitude to an API route. The route looks up a city and country through a third-party service, then returns a path and location data—or a 404 when no match is found. Next.js and Remix implement this route differently. section 11.3.4
Figure 9.4 When we store data locally, we can dip into the local data when we want to display it, but when we store the data remotely, we have to wait for the server to respond before we can display anything. This process has to occur every time we read or write data. Note also that every time we move from local to remote data, we have to agree on the format between the two parts of the applications; this format agreement is known as the API.
Compare local data access with remote requests and see why both sides must agree on a data format. section 9.2.2











































