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: 4 months 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 (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-01T08:42:42.000Z (over 4 years ago)
- Last Synced: 2025-01-31T15:17:23.365Z (5 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}
};```