Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhay557 authored May 15, 2024
1 parent 96191cf commit a285aa6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
# quote-app
an web-app which displays quotes using api data

### About concept
- its fetches the api and display the quotes in container.
- with the help of body tag and display (flex) properties i have centered both div and content.
- in javascript i used the DOM (Document Object Model) concept to display that data on a webpage.
```js
document.addEventListener('DOMContentLoaded', function () {
fetch('https://random-api.xyz/api/fun/fortune')
.then(response => response.json())
.then(data => {
const apiDataElement = document.getElementById('apiData');
apiDataElement.textContent = JSON.stringify(data.fortune);
console.log(data);
})
.catch(error => {
console.error('Error fetching API data:', error);
});
});
```

### API
- [link to api](https://docs.random-api.xyz)

0 comments on commit a285aa6

Please sign in to comment.