Edit on val.town ↗

HTTP

HTTP triggers give your files a live URL, like solitaire-game.val.run. So you can serve a website, an API, an MCP server, handle a webhook, and more.

To add an HTTP trigger, click the + Add trigger button atop your editor and select HTTP. You can also add/remove triggers from the triple dots menu in the top right corner, or via our MCP server.

add an http trigger

Once you've added an HTTP trigger, you can copy its URL and open a preview. You can also use a custom domain like acme.app or custom subdomain, like jitterbug.val.run.

edit an http subdomain

We use web standard Request and Response objects, so you can use compatible web frameworks like Hono. The triggered file's default export takes a Request object and returns a Response:

export default async function (req: Request): Promise<Response> {
  return Response.json("hello, http!");
}

To learn more about what you can do with HTTP triggers, read:

Last updated