Welcome to the new Golem Cloud Docs! 👋
HTTP client

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

For WebSocket connections, see the WebSocket client page. The HTTP APIs described above do not support WebSocket upgrades.