Logo Runner — Httpbun

Build your own API endpoint, by writing Javascript to handle the request.

This is experimental, and may change or disappear some day, with little notice.

Reference

The code is the body of a function, that gets the request as R, and returns the response. It has 100ms to run. R has these fields:

R and R.headers are read-only, and trying to change them throws an error. To set response headers, return them in the headers field.

The returned object can have these fields, all optional:

For example, to respond with the request's user agent:

return {
    headers: {"content-type": "text/plain"},
    body: "You are " + R.headers["user-agent"]
}