TODO
Install the typescript definitions: https://bun.sh/docs/typescript
Import a JSON file with Bun
https://bun.sh/guides/runtime/import-json
https://bun.sh/docs/api/file-io
fetch('https://dummyjson.com/products/', {
method: 'GET',
headers: {
'Accept': 'application/json',
},
})
.then(response => response.json())
.then(data => {
//console.log(data)
Bun.write("data.json", JSON.stringify(data,null,2));
data.products.forEach(element => {
if (element.id < 7)
{
console.log(element.title)
}
});
})