How to use Fetch with JavaScript




Fetch is a promise based HTTP request API. It’s fairly well supported (87%+ https://caniuse.com/#feat=fetch) and is promise based for ease of use and is a perfect fit for those wanting to use out of the box solutions for HTTP.

For more information, check out the MDN documentation on how to use Fetch within your project(s): https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

https://caniuse.com/#feat=fetch

Chat with me, join the Slack group! http://bit.ly/JoinPaulHallidaySlack

I have courses related to Angular, Ionic, Fuse, Firebase and much more at: https://paulhalliday.io

My NativeScript courses can be found at:
https://nativescripting.com/course/nativescript-with-angular-web-application-conversion
https://nativescripting.com/course/nativescript-with-@ngrx

I also have an Ionic book:
https://leanpub.com/30daysofionicframework

Prefer written content or want a text version of the videos? Check out
my blog: https://blog.paulhalliday.io

Support the content with at least $1 for EXCLUSIVE early access to the next video(s), as well as other benefits! https://www.patreon.com/PaulHalliday

You can also support the content by keeping me caffeinated (much appreciated!): http://paypal.me/PWHSoftware

The extra epic content always comes via email first. Sign up so you’re not left behind: http://eepurl.com/cBCqO9

You can also find me:

https://www.facebook.com/PaulHalliday.io
http://twitter.com/PWHSoftware
http://linkedin.com/in/paulhal

Original source


31 responses to “How to use Fetch with JavaScript”

  1. There is so much missing information in this.

    Where do you put this code?
    Do you put it in server.js where express is?

    How do you fetch data from an API?
    What if the API requires a key? How do you input a key?

    If the URL you're fetching from requires the content of the form, how do you get the values from the form to be included in the URL in the fetch in the first place?

  2. Hi Paul. Thank you for a tutorial about Fetch with JS. One question: It means that I can create own post, then to make a request to use it in my app, correct? So, where data will be stored? Also, I would like to use some own images for the data request, is it possible, please explain how to add images as well. Thank you in advance.

  3. Hi paul, thanks for the tutor ! 😉 if its not bother you, can i ask you about making a video about an introduction to OAuth 2.0 and using fetch to get an access token ? Ive been stumbling with this oauth system. Thank you so much before paul

Leave a Reply