val-town-docs icon indicating copy to clipboard operation
val-town-docs copied to clipboard

Add interactive samples in the REST API section

Open pomdtr opened this issue 1 year ago • 0 comments

This makes uses of the vt-playground web components.

image

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"));

pomdtr avatar Mar 20 '24 18:03 pomdtr