Fetching data from an endpoint
The Fetch API
The Fetch API has been designed for fetching resources, including over the network. At the time of writing, its specification, although really promising, has still not been approved. However, many modern browsers such as Chrome, Edge, and Firefox already support it. For the others, a polyfill is required.
The Fetch API relies on the notions of requests and responses. This allows for interception pipelines that can modify requests before they are sent and responses when they are received. It makes working with things such as authentication and CORS much easier.
In the following sections, the terms
Response refer to the Fetch API's classes. The Mozilla developer network has extensive documentation ...