0% found this document useful (0 votes)
6 views

Integrative Programming -Fetch, GET, POST, PUT, DeLETE Methods

The document provides a tutorial on using the Fetch API in JavaScript to make GET, POST, PUT, and DELETE requests. It emphasizes the promise-based nature of Fetch and discusses handling results with both .then/.catch and async-await syntax. The document includes specific sections on making each type of request and their respective handling methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Integrative Programming -Fetch, GET, POST, PUT, DeLETE Methods

The document provides a tutorial on using the Fetch API in JavaScript to make GET, POST, PUT, and DELETE requests. It emphasizes the promise-based nature of Fetch and discusses handling results with both .then/.catch and async-await syntax. The document includes specific sections on making each type of request and their respective handling methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Integrative

Programming

Joie Velasco
Using fetch to make GET,
POST, PUT and DELETE
requests
TABLE OF CONTENTS
1.Making a fetch GET request
• GET request with result-handling
2.Making a fetch POST or PUT request
• POST/PUT with result-handing
3.Making a DELETE request
• DELETE with result-handling
4.Fetch with async-await syntax
5.Summary
• Fetch is JavaScript’s in-built method (available via the global
window object) for making HTTP requests.

• It is promise-based: after making a GET, POST, PUT or


DELETE request, the Fetch API returns a promise containing
the result of the request. So before proceeding with this
tutorial, it is a good idea to have a solid understand of how
to handle JavaScript promises using

• .then and .catch syntax

• Alternatively, the result of a fetch request can be handled


using async-await syntax.
Making a fetch GET request
By default, fetch() makes a GET request.
• This means that there is less code to write for this type
of request than others.
The syntax of a fetch GET request is
as follows:

You might also like