pomdtr
valtownByExample
HTTP
Val town by example Usage Simple Example To add an example, just create a val.
The val should start with a JSDoc style multi line comment that describes the example: /**
* @title HTTP server: Hello World
* @description An example of a HTTP server that serves a "Hello World" message.
*/
// this comment will be displayed on the left
export const server = () => new Response("Hello world!") The title is required. Then, you can write the code.
Code can be prefixed with a comment that describes the code.
The comment will be rendered next to the code in the example page. Make sure your val is public, then go to https://pomdtr-val_town_by_example.web.val.run/v/<your-username>/<your-val> Using multiple vals You can add another val to your example by adding an @include directive /**
* @title HTTP server: Hello World
* @description An example of a HTTP server that serves a "Hello World" message.
* @include pomdtr/secondary_val
*/ See @pomdtr/react_example Adding external resources to your example You can attach an external link to your val by using the @resource directive. External resources are specified using a markdown link. /**
* @title HTTP server: Hello World
* @description An example of a HTTP server that serves a "Hello World" message.
* @resource [Val Town Docs](https://docs.val.town)
**/ Adding examples to the homepage Just add your val in @pomdtr/val_town_by_example_toc
3
Updated: April 7, 2024