diff --git a/rest/fetch.js b/rest/fetch.js new file mode 100644 index 0000000..d468b5e --- /dev/null +++ b/rest/fetch.js @@ -0,0 +1,25 @@ + +// fetch('https://jsonplaceholder.typicode.com/posts') +// .then(res=>res.json()) +// .then(adatok=>console.log(adatok)) +// .catch(err=>console.log(err)) + + + + + +async function letolt() { + try { + let keres=await fetch('https://jsonplaceholder.typicode.com/posts/1'); + let valasz=await keres.json(); + + console.log(valasz); + + } catch (error) { + console.log(error); + } +} + +letolt(); + +console.log("Valami"); \ No newline at end of file diff --git a/rest/index.html b/rest/index.html new file mode 100644 index 0000000..68efde9 --- /dev/null +++ b/rest/index.html @@ -0,0 +1,12 @@ + + +
+ + +