1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const githubUser = (async () => {
4 const username = "stevekrouse";
5 const user = await fetchJSON(
6 `https://api.github.com/users/${username}`,
7 );
4 app.get("/", (c) => c.text("Hono yes?"));
5 app.get("/yeah", (c) => c.text("Routing ok!"));
6 return app.fetch(req);
7};
8// Forked from @tmcw.honoExample
1export const CLIBlog = (async () => {
2 // let response = await fetch(
3 // "https://example-files.online-convert.com/document/txt/example.txt",
4 // );
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const buddhaRandomQuote = (async () => {
4 const resp = await fetch("https://buddha-api.com/api/random");
5 const j = await resp.json();
6 const { text, byName } = j;
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3import { resume as resume2 } from "https://esm.town/v/ajax/resume";
50 `;
51 console.log({ prompt });
52 const response = await fetch("https://api.openai.com/v1/completions", {
53 method: "POST",
54 headers: {
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function fetchRssParser(rssUrl) {
4 // fetch the rss xml
5 const rssResult = await fetch(rssUrl).then((res) => res.text());
6 // parse xml to object
7 const { XMLParser } = await import("npm:fast-xml-parser");
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function finalUrl(req: Request) {
4 const url = new URL(req.url).pathname.replace(/^\//, "");
5 const response = await fetch(url);
6 return new Response("", {
7 headers: {
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
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 = {
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function valToString(val: string) {
6 }
7 const [author, name] = val.split(".");
8 const resp = await fetch(`https://api.val.town/v1/alias/${author}/${name}`);
9 if (resp.status !== 200) {
10 throw new Error(resp.statusText);
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const todosPlaceholder = (async () => {
4 const resp = await fetch("https://jsonplaceholder.typicode.com/todos");
5 return resp.json();
6})();