Browse documentation
On this page

Peren documentation

HTTP API example

A minimal Worker that returns JSON for the request path.

Create worker.js:

export default {
  async fetch(request) {
    return Response.json({ path: new URL(request.url).pathname });
  },
};

Create a fleet file with one service and one public socket, for example after peren init, then run:

peren serve fleet.toml

In another terminal:

curl http://127.0.0.1:8080/orders

The response body is:

{"path":"/orders"}

For the full first-run path, including certificates and durable state, use Quickstart and Build your first Durable Object.