async function fetchData() {
try {
const result = await axios.get("https://randomuser.me/api/")
console.log(result.data));
} catch (error) {
console.error(error);
}
}
async function fetchMovies() {
const response = await fetch('/movies');
// waits until the request completes...
console.log(response);
}
import { fetch } from "undici";
const data = {
async *[Symbol.asyncIterator]() {
yield "hello";
yield "world";
},
};
(async () => {
await fetch("https://example.com", { body: data, method: 'POST' });
})();