HTTP requests
HTTP requests can be made with the standard fetch
function.
For example:
const response = await fetch(`http://localhost:${port}/todos`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
title: "foo",
body: "bar",
userId: 1
})
const data = await response.json();
console.log("Body: ", data);
});