Use the Dad Joke API to get a dad joke and display it to the user.
Use fetch or axios to send an HTTP request to https://icanhazdadjoke.com/
with the accept
header as application/json
. This will return a dad joke in JSON format. You can then use the .json()
method on the response to get a javascript object. Get the joke out of the object and show it to the user.
fetch("https://icanhazdadjoke.com/", {
headers: {
accept: "application/json"
}
}).then(response => response.json())
.then(data => console.log(data))
Add the ability to "search" for jokes using another endpoint.
Add some styling! Flex your css skills.