Skip to content

Fetch API

The Fetch API provides a modern, promise-based interface for making HTTP requests. It replaces the older XMLHttpRequest.

  • Make GET, POST, PUT, and DELETE requests with fetch
  • Parse responses in different formats
  • Handle HTTP errors correctly

Fetch returns a Promise resolving to a Response object. Use response.json() for JSON. Check response.ok for HTTP errors.