val-town-docs
val-town-docs copied to clipboard
Add interactive samples in the REST API section
This makes uses of the vt-playground web components.
I found out multiple broken vals while editing the examples, so I updated them.
I would advise to only import fetchJSON in the api examples.
Wrapping the logic in other vals makes a lot of example useless. ex:
import { alias } from "https://esm.town/v/neverstew/alias";
export let aliasExample = alias({ //
username: "stevekrouse",
});
This example requires you to read the neverstew/alias val, so I converted it to:
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
console.log(await fetchJSON("https://api.val.town/v1/alias/stevekrouse"));