5 async function request(url) {
6 console.log(url);
7 const res = await fetch(url);
8 return load(await res.text());
9 }
1Migrated from folder: bluesky/fetchBlueskyPost
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function fetchTweet(url) {
4 const tweetId = url.match(/(\d{19})/)[1];
5 const token = getToken(tweetId);
8 tweetURL.searchParams.set("lang", "en");
9 tweetURL.searchParams.set("token", token);
10 const res = await fetch(tweetURL, {
11 redirect: "follow",
12 });
15}
16
17// @see: https://github.com/vercel/react-tweet/blob/a292ca7/packages/react-tweet/src/api/fetch-tweet.ts#L27-L31
18function getToken(id: string) {
19 return ((Number(id) / 1e15) * Math.PI)
1Migrated from folder: a0_forks/fetchTweet
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3await fetchJSON("https://api.val.town/v1/vals", {
4 headers: {
5 Authorization: `Bearer ${Deno.env.get("valtown")}`,
7app.all("/greet/:name", hydrate("pomdtr/example_greet_component"));
8
9export default app.fetch;
16- [2024-04-09 - reactiveStateBlob: wrap blob state in a proxy to autosave it on changes](https://val.town/v/postpostscript/reactiveStateBlob)
17- [2024-04-24 - lock: lock that releases when it leaves the execution context](https://val.town/v/postpostscript/lock)
18- [2024-04-25 - fetchWorker: communicate with a worker over a fetch-like interface](https://val.town/v/postpostscript/fetchWorker)
19- [2024-01-06 - interruptibleChain: simple interface for pausing and resuming execution chains](https://val.town/v/postpostscript/interruptibleChain) (now at https://github.com/postpostscript/chain)
20- [2024-01-07 - expiringBlob: create-and-forget blobs using UUIDv7](https://val.town/v/postpostscript/expiringBlob)
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function alias<P extends Params>(params: P): Promise<Result<P>> {
9 if ("valName" in params && params.token)
10 headers.Authorization = `Bearer ${params.token}`;
11 return fetchJSON(url, { headers });
12}
13type UserParams = {
22 const onData = onSubmit ? onSubmit(e) : () => 1;
23 const formData = new FormData(e.target as any);
24 const resp = await fetch("/", {
25 method: props.action ?? "POST",
26 body: formData,
1import { fetch } from "https://esm.town/v/std/fetch";
2
3const gist =
5
6export const queryParams = async (req: Request) => {
7 const data = await fetch(gist);
8 const jsonData = await data.json();
9