A val that works with the Web API takes a Request object as input and needs to return a Response object.
The most basic example can ignore the request and just return a response, even using a shorthand method like Response.json, which is part of the web standard.
A slightly more built-out val can return HTML along with the correct Content-Type header:
Now let’s work with the request: this echoes request headers back in the response:
We can grab query parameters using the web standard URLSearchParams class: