1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let blocks = async (req, res) => {
23 }
24 }"
25 x-init="blocks = await (await fetch('https://storage.googleapis.com/bb-search-data/parsed/blocks-min.json')).json()"
26 >
27 <div class='grid gap-4 grid-cols-4 lg:grid-cols-8'>
51 </html>`);
52 }
53 const gistRes = await fetch(`https://api.github.com/gists/${id}`);
54 if (!gistRes.ok) {
55 return res.send("GitHub replied with a non-200 status.");
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function nominatimSearch(params: Search): Promise<Place[]> {
4 return fetchJSON(
5 "https://nominatim.openstreetmap.org/search?" +
6 new URLSearchParams({
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export async function valOutput(req: Request) {
10 const author = match[1];
11 const name = match[2];
12 const val = await fetchJSON(
13 `https://api.val.town/v1/alias/${author}/${name}`,
14 );
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2import { round } from "https://esm.town/v/stevekrouse/round";
3import { nominatimSearch } from "https://esm.town/v/stevekrouse/nominatimSearch";
16 console.log({ lat, lon, display_name });
17 let url = `https://opensky-network.org/api/states/all?${query}`;
18 let data = await fetchJSON(url);
19 return data?.states?.map((f) => ({
20 icao24: f[0],
1import { msDay } from "https://esm.town/v/stevekrouse/msDay";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4// deprecated in favor of @stevekrouse.openAQLocation
5export let aqiLocation = async ({ lat, lon }: { lat: number; lon: number }) => {
6 const { results } = fetchJSON(
7 "https://api.openaq.org/v2/locations?" +
8 new URLSearchParams({
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
2
3export let dateMeRSSText = fetchText(
4 "https://stevekrouse-dateMeRSS.express.val.run",
5);
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3// accessible via API at https://api.val.town/eval/@stevekrouse.basicAPIEx
4export const basicAPIEx = fetchJSON(
5 "https://date.nager.at/api/v2/publicholidays/2023/US"
6);
1import { fetch } from "https://esm.town/v/std/fetch";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export let hnTopStoryExecuted = (async () => {
5 const topStories: Number[] = await fetch(
6 "https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"
7 ).then((res) => res.json());
14 score: number;
15 by: string;
16 } = await fetchJSON(
17 `https://hacker-news.firebaseio.com/v0/item/${id}.json`
18 );
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
2let { valbeeTest } = await import("https://esm.town/v/stevekrouse/valbeeTest");
3
4export const valBeeExample = async () => {
5 return (valbeeTest = fetchText(
6 "http://numbersapi.com/random/math"
7 ));
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
2
3export let badArgs1 = (async () => {
4 // this should error helpfully
5 console.log(
6 await fetchText(
7 "https://api.val.town/v1/run/stevekrouse.id",
8 {
14 // this should error helpfully
15 console.log(
16 await fetchText(
17 "https://api.val.town/v1/run/stevekrouse.id",
18 {
26 // this is a proper call
27 console.log(
28 await fetchText(
29 "https://api.val.town/v1/run/stevekrouse.id",
30 {