Basic examples
HTTP triggers create a URL on the public internet, like example.val.run. Copy
a URL by opening a file with an HTTP trigger and clicking the copy button, or by
opening the menu for that file in the file tree.
By default, URLs will be a long mess of characters, but you can easily add custom subdomains.
Return JSON
The simplest endpoint returns a simple JSON message:
Return HTML
Or return HTML with the corresponding Content-Type header:
Return JSX
You can also use JSX, like React:
See more examples of returning HTML and JSX.
Reading POST request body
You can also get the body of POST requests:
Reading headers & query parameters
This echoes request headers back in the response:
We can get and return the request URL's query parameters:
Last updated