Currently our implementation just returns hardcoded data that we have in JSON. We want real data!
This lesson swaps out our hardcoded data for real endpoints.
Instructor: [0:00] Our next step is to really get this data from the server. We want to fetch the listing data from this URL. We get our result by awaiting fetch with this URL we just used and we get the data out of that by awaiting result.json. [0:28] Then, we return the data. This right now has no error handling. Let's do that too. If result is OK, we do this. Otherwise, we return an error. Something went wrong. Now, we can repeat the same for our other endpoint.
[0:55] Get the right URL here. If we look at the browser, let's get the data but now from the server.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!