Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thedvlprs/fetch-api-promises
🔥 Basic code showing how to use Fetch API and Promises
https://github.com/thedvlprs/fetch-api-promises
demo fetch-api ghibli-api json promises
Last synced: 21 days ago
JSON representation
🔥 Basic code showing how to use Fetch API and Promises
- Host: GitHub
- URL: https://github.com/thedvlprs/fetch-api-promises
- Owner: thedvlprs
- Created: 2020-12-01T08:41:47.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-01T08:42:42.000Z (about 4 years ago)
- Last Synced: 2024-12-04T15:14:38.697Z (3 months ago)
- Topics: demo, fetch-api, ghibli-api, json, promises
- Language: JavaScript
- Homepage: https://jaded-hate.surge.sh/
- Size: 1000 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://forthebadge.com)
## Basic code showing how to use Fetch API and Promises
```javascript
const URL = "https://ghibliapi.herokuapp.com/people";
const main = document.getElementById("main");
main.innerHTML = "Loading...";
fetch(URL)
.then((response) => response.json())
.then((people) => main.innerHTML = getListOfNames(people));
const getListOfNames = (people) => {
const names = people
.map((person) => `
.join("\n");
return `
- ${names}
};```