DEV Community

Cover image for Mastering API Fetch: How to Build a Movie Website with Real-Time Data Updates

Mastering API Fetch: How to Build a Movie Website with Real-Time Data Updates

Tracy | Software Engineer on June 02, 2023

Learn how to use the Fetch API to asynchronously request data from an external API and dynamically build a movie website. This beginner-friendly tu...
Collapse
 
sebastian_wessel profile image
Sebastian Wessel • Edited

As far as I know - maybe I'm wrong - fetch does not throw like axios or got lib on http errors like 404.

There is a result.ok which can/should be used to evaluate that the response is some 200 and not some 404 or 500. And in case of an error, you can simply use response.json() to get the error response sent from server - much easier than with axios

So the try-catch-block might not work as you expected here.

Collapse
 
tracy4code profile image
Tracy | Software Engineer

Thanks for the heads up. I will keep that in mind.

Collapse
 
sebastian_wessel profile image
Sebastian Wessel

Yeah, it’s a bit unexpected here, because it follows more the Rust language response handling and not the typical JavaScript-simply-throw pattern.

I only mentioned it, because I was doing it wrong, lost quite some time on it - one or two weeks ago πŸ€«πŸ˜‚

Thread Thread
 
tracy4code profile image
Tracy | Software Engineer

Well, it is not something I am familiar with so I had to check it out. It actually works so thanks.

Collapse
 
emma32 profile image
emma devid

Discover the ultimate Goku experience with our Goku to Movies app! Immerse yourself in the world of epic battles and heroic deeds as you stream your favorite Goku movies and episodes. Download now to join Goku on his legendary quest and unleash the power of the Saiyan warrior within!

Collapse
 
emma32 profile image
emma devid

It's a bit surprising here, as it aligns more with Rust's response handling rather than the typical JavaScript 'simply throw' pattern. I bring it up because I recently encountered this myself, spending quite some time on it about a week or two ago.
Regards: sonic happy hour

Collapse
 
emma32 profile image
emma devid

I was not familiar with this either, so I looked into it. It does work thanks for the tip Interestingly I found that it also enhances overall performance if used consistently.
Regards: ff advance server

Collapse
 
clark profile image
Ronda

Great tutorial for beginners! Explains Fetch API and dynamic website creation well. To add, tamildhool app apk download free offers a similar concept for Indian movie lovers, providing real-time updates and a user-friendly interface for watching Tamil movies on the go.

Collapse
 
josephfisher profile image
Joseph Fisher

Thanks for sharing, I will definitely try this on Goku.to Movies.

Collapse
 
emma32 profile image
emma devid

for you favourtie action games regarding free fire, you must join free fire advance server which has spanish version servidor avanzado free fire

Collapse
 
nabiullah748957 profile image
Nabi Ullah

Stream your favorite movies anytime, anywhere with Goku.tu Movies App your ultimate destination for cinematic delights.

Collapse
 
nabiullah748957 profile image
Nabi Ullah • Edited

Unlock a world of cinematic wonders with Goku.tu App, boasting an extensive library of films across genres.

Collapse
 
emma32 profile image
emma devid

you have given a great app. i loved to watch movies on your app. here is another application which is use to play game that is servidor avanzado ff