Skip to content

HTTP

HTTP triggers let you serve a scalable API or website.

To add an HTTP trigger, click the + button in the top right of your val editor and select HTTP.

add HTTP trigger

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

The triggered file’s default export takes a Request and returns a Response:

export default async function (req: Request): Promise<Response> {
return Response.json({ ok: true });
}

View and run this example on Val Town

export function handler(request: Request) {
return Response.json({ ok: true });
}