feat(async-await): initial commit
This commit is contained in:
parent
e3faa5d815
commit
c291026248
|
@ -0,0 +1,12 @@
|
||||||
|
function fetchDataFromApi() {
|
||||||
|
console.log('fetchDataFromApi() start...');
|
||||||
|
|
||||||
|
fetch('https://v2.jokeapi.dev/joke/Programming?type=single')
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(json => console.log(json.joke));
|
||||||
|
|
||||||
|
console.log('fetchDataFromApi() done.');
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchDataFromApi()
|
||||||
|
console.log('index: Finished fetching data.');
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"name": "async-await",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "async await",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "Software Ingenieur Begerad <dialog@SwIngBe.de>",
|
||||||
|
"license": "GPL-3.0-or-later"
|
||||||
|
}
|
Loading…
Reference in New Issue