What's the best way to make a REST API request in JavaScript? or How do I properly handle a REST API

20 Replies, 1290 Views

Dude, same. Fetch() is *so* inconsistent.

Two things:
1) Add headers like `'Content-Type': 'application/json'`
2) Use `response.ok` to check if the request worked

Also, Postman is great for testing APIs before coding. Saves a ton of headache!

Messages In This Thread



Users browsing this thread: 1 Guest(s)