14 await blob.setJSON(genKey(key), url);
15 }
16 return new Response((await fetch(url)).body, { headers: { "content-type": "image/jpg" } });
17}
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export interface ValResponse {
30
31export function createVal({ token, ...data }: { token?: string } & CreateValArgs): Promise<ValResponse> {
32 return fetchJSON("https://api.val.town/v1/vals", {
33 bearer: token || Deno.env.get("valtown"),
34 method: "PUT",
23 const onData = onSubmit ? onSubmit(e) : () => 1;
24 const formData = new FormData(e.target as any);
25 const resp = await fetch("/", {
26 method: props.action ?? "POST",
27 body: formData,
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2import { thisWebURL } from "https://esm.town/v/stevekrouse/thisWebURL";
3
4async function alphaVantage(symbol: string) {
5 let data = await fetchJSON(
6 `https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=${symbol}&apikey=${Deno.env.get("alphaVantage")}`,
7 );
10
11export function getStockData(symbol: string) {
12 return fetchJSON(
13 `${thisWebURL()}?symbol=${symbol}`,
14 );
8
9function esmTown(url) {
10 return fetch(url, {
11 headers: {
12 "User-Agent":
17
18const app = new Hono();
19export default app.fetch;
20
21app.get("/", async (c) =>
1import { fetch } from "https://esm.town/v/std/fetch";
2
3function fetchJSON(url) {
4 return fetch(url).then(res => res.json());
5}
6
7export let currency = async (desired, base = "usd", amount = 1) => {
8 let { rates } = await fetchJSON(`https://open.er-api.com/v6/latest/${base}`);
9 if (rates && rates[desired.toUpperCase()]) return amount * (rates[desired.toUpperCase()]);
10 else {
11 let { rates } = await fetchJSON("https://api.coingecko.com/api/v3/exchange_rates");
12 return amount * rates[desired.toLowerCase()]?.value / rates[base.toLowerCase()]?.value;
13 }
1import { blob } from "https://esm.town/v/std/blob?v=12";
2import { email } from "https://esm.town/v/std/email";
3import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
4
5export default async function(interval: Interval) {
44
45export async function getLakeTemp() {
46 const result = await fetchText("https://www.omniafishing.com/w/candlewood-lake-3-fishing-reports/current-conditions");
47 const temperature = result.match(/<strong>([0-9]+)/)[1];
48 return parseInt(temperature);
11blob.setJSON;
12
13const fetch = async (req: Request): Promise<Response> => {
14 let repp = new Repp([{
15 code: "",
165}
166
167export default fetch;
168// https://stackoverflow.com/a/67394423/1333724
169// var __EVAL = async (s) => eval(`(async () => (void (__EVAL = ${__EVAL.toString()}); ${s}))()`);
173// // evaluate("ten + cube(3)");
174// evaluate(`
175// let resp = await fetch('https://www.google.com');
176// console.log(resp)
177// let x = 10
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=44";
2import { google } from "npm:googleapis";
3
4export async function getAccessToken(accountId: string, bearer = Deno.env.get("pipedream")) {
5 const response = await fetchJSON(
6 `https://api.pipedream.com/v1/accounts/${accountId}?include_credentials=1`,
7 { bearer },
4app.get("/", (c) => c.text("Hello from Hono!"));
5app.get("/yeah", (c) => c.text("Routing!"));
6export default app.fetch;