Rest API teszt

This commit is contained in:
Kovács Rudolf
2026-10-21 11:16:53 +02:00
parent f2c32b0c9b
commit b4e90847af
3 changed files with 52 additions and 0 deletions

25
rest/fetch.js Normal file
View File

@@ -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");