Skip to content

HTTP

HTTP Vals let you expose an API or website from your val.

They are built on the web-standard Request and Response objects, so are compatible with a number of web frameworks like Hono and Peko.

These handlers need to export a function that takes a Request object as the first parameter and returns a Response object. The function can be asynchronous.

ExampleRun in Val Town ↗
export function handler(request: Request) {
return Response.json({ ok: true });
}

Limitations

The maximum size for requests is 2mb and the maximum size for responses is 250kb.