3 const app = new Elysia()
4 .get("/", () => "Hello Elysia");
5 return app.fetch(req);
6};
1import { searchParams } from "https://esm.town/v/stevekrouse/searchParams";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export function runs({ token, error, source, since, until, offset, limit }: {
34 };
35}> {
36 return fetchJSON(
37 "https://api.val.town/v1/me/runs?" + searchParams({
38 error: error?.toString(),
1import process from "node:process";
2import { basicAuthorization } from "https://esm.town/v/stevekrouse/basicAuthorization";
3import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
4
5/*
14*/
15export const mt = async (req, res) => {
16 const r = await fetchJSON(
17 "https://app.moderntreasury.com/api/user_onboardings",
18 {
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Use this to get the Bluesky posts from any user.
4// Just pass in their username (like "vgr.bsky.social")
5export const bskyPosts = async (repo = "scottraymond.com") => {
6 const { records } = await fetchJSON(
7 `https://bsky.social/xrpc/com.atproto.repo.listRecords?repo=${repo}&collection=app.bsky.feed.post`
8 );
1import { fetch } from "https://esm.town/v/std/fetch";
2
3// E.g. from a user's perspective (not the real execution time!)
8 for (let i = 0; i < count; i++) {
9 let start = Date.now();
10 await fetch("https://api.val.town/eval/(()=%3E1+1)()");
11 evalTimes.push(Date.now() - start);
12 }
23 for (let i = 0; i < count; i++) {
24 let start = Date.now();
25 await fetch("https://api.val.town/eval/@healeycodes.addOnes()");
26 userFuncTimes.push(Date.now() - start);
27 }
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// GitHub followers
4export let githubFollowers = fetchJSON(
5 "https://api.github.com/users/stevekrouse/followers"
6);
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Reddit recent posts from /r/aww (cute animals)
4export let subredditExample = fetchJSON(
5 "https://www.reddit.com/r/aww/.json"
6);
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let shortenUrl = async (url) => {
5 url: url,
6 };
7 let resp = await fetch("https://api.util.fyi/shorten/", {
8 method: "POST",
9 headers: {
1import { fetchJSON } from "https://esm.town/v/simply_say_m/fetchJSON";
2
3// Activity suggestions for when you're bored
4export let boredActivities = async () => {
5 const { activity } = await fetchJSON(
6 "https://www.boredapi.com/api/activity",
7 );
1export let handleFetchTextResponse = async function (response: Response) {
2 if (response.ok) {
3 return await response.text();