1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3console.log(
4 await fetchJSON(
5 "https://api.val.town/v1/eval",
6 {
152
153export async function sendNotification(baseURL: string, body: NtfyJSONBody): Promise<Response> {
154 return await fetch(baseURL, {
155 method: "POST",
156 body: JSON.stringify(body),
82 return new Response(
83 `/// <reference no-default-lib="true"/>\n`
84 + ((await Promise.all(urls.map(url => fetch(url).then(res => res.text())))).join("\n\n").replace(
85 /^\/\/\/.+/gm,
86 "",
228});
229
230export default app.fetch;
8
9```ts
10import { fetch } from "https://esm.town/v/std/fetch";
11import { json_viewer } from "https://esm.town/v/stevekrouse/json_viewer";
12
13export const weatherDescription = async (params: string[]): Promise<unknown> => {
14 let data = await fetch(`https://wttr.in/${params["city"]}?format=j1`);
15 let jsonData = await data.json();
16 return json_viewer(jsonData);
718 if (load) {
719 try {
720 code = await (await fetch(new URL(load, "https://esm.town/v/"))).text();
721 } catch (e) {
722 code = `/*\nFailed to load '${load}': ${e}\n*/`;
754 );
755 } else {
756 const res = await fetch(API_URL + "/v1/eval", {
757 method: "POST",
758 body: JSON.stringify({
801 }
802});
803export default app.fetch;
804type Log = {
805 type: string;
1import { fetchRSS } from "https://esm.town/v/stevekrouse/fetchRSS";
2
3export let newRSSItems = ({ url, lastRunAt }) =>
4 fetchRSS(url)
5 .then(({ channel: { item } }) =>
6 (Array.isArray(item) ? item : [item]).filter(
1import { fetchRSS } from "https://esm.town/v/stevekrouse/fetchRSS";
2
3export let newRSSItems = ({ url, lastRunAt }) =>
4 fetchRSS(url)
5 .then(({ channel: { item } }) =>
6 (Array.isArray(item) ? item : [item]).filter(
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import { nominatimSearch } from "https://esm.town/v/stevekrouse/nominatimSearch";
4import { weatherGovGrid } from "https://esm.town/v/stevekrouse/weatherGovGrid";
14 lon,
15 });
16 let { properties: { periods } } = await fetchJSON(
17 grid.forecastHourly,
18 );
1import { prettifyHtml } from "https://esm.town/v/neverstew/prettifyHtml";
2import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
3import { escape } from "npm:html-sloppy-escaper";
4
5export default async function viewSource(req: Request) {
6 const pathname = new URL(req.url).pathname;
7 const html = await fetchText(pathname === "/" ? "example.com" : pathname); // .then(prettifyHtml);
8 const body = `<html>
9 <head>