Learn how to use the Fetch API in Node.js, Deno, and Bun. Fetch API is a native alternative to XMLHttpRequest for making HTTP requests in browsers and server-side code. The API is identical across platforms, but there are some restrictions when making client-side fetch requests. You can manipulate and examine HTTP headers in the request and response using a Headers object. Fetch requests can be customized using options such as method, headers, and credentials. The fetch() promise resolves even if the server returns a 404 error. Aborting fetch requests can be done using an AbortController or AbortSignal. Making fetch requests in series may not be efficient, consider using Promise.allSettled() for concurrent requests.
Table of contents
Fetch API vs XMLHttpRequestA Basic Fetch ExampleClient-side vs Server-side FetchCustom Fetch RequestsHandling HTTP HeadersFetch Promise Resolve and RejectAnalyzing Fetch ResponsesAborting Fetch RequestsEffective FetchesSummarySort: