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>
4let location = "brooklyn ny";
5let lang = "en";
6const weather = await fetch(
7 `https://wttr.in/${location}?lang=${lang}&format=j1`,
8).then(r => r.json());
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
2import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
3import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
4import { sqlToCSV, sqlToJSON } from "https://esm.town/v/nbbaier/sqliteExportHelpers";
147});
148
149export const handler = app.fetch;
150
151export default modifyFetchHandler(passwordAuth(handler));
1/** @jsxImportSource https://esm.sh/react */
2import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=46";
3import { email } from "https://esm.town/v/std/email?v=11";
4import { sqlite } from "https://esm.town/v/std/sqlite";
19}
20
21export const reactExample = modifyFetchHandler(async (request: Request) => {
22 const url = new URL(request.url);
23 if (url.pathname === "/favicon.ico") return new Response(null, { status: 404 });
18};
19
20const result = await fetch("https://blog.edgeesmeralda.com/api/v1/free", {
21 "headers": {
22 "content-type": "application/json",