harlequinCobramain.tsx2 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
23export async function getWeather(city: string): Promise<WeatherResponse> {
4return fetchJSON(`https://wttr.in/${city}?format=j1`);
5}
6
kyselyVtTypesmain.tsx1 match
55"embed",
56"document",
57].includes(req.headers.get("sec-fetch-dest"))
58)
59return new Response(
16const pathname = `/api/latest/user/${user}/workspace/${workspace}/query`;
1718const resp = await fetch(`${origin}${pathname}?sql=${encodeURIComponent(sql)}`, {
19headers: {
20Authorization: `Bearer ${Deno.env.get("PIPES_TOKEN")}`,
12
13try {
14const response = await fetch(url);
15const data = await response.json();
16return data;
10}
1112export async function fetchEnv() {
13const { data: res, error } = await fetchValTown("/v1/eval", {
14method: "POST",
15body: JSON.stringify({
28}
2930export async function fetchValTown<T = any>(
31path: string,
32options?: RequestInit & {
4546while (true) {
47const resp = await fetch(url, {
48headers,
49});
68}
6970const resp = await fetch(`${apiURL}${path}`, {
71...options,
72headers,
96: {};
9798const { data: me } = await fetchValTown("/v1/me");
99const valDir = path.join(Deno.cwd(), me.username);
100if (!existsSync(valDir)) {
112confirm(`A new val ${file} was found. Do you want to create it on remote?`)
113) {
114const { data } = await fetchValTown("/v1/vals", {
115method: "POST",
116headers: {
139140if (confirm(`File ${file} has changed. Do you want to update it on remote?`)) {
141await fetchValTown(`/v1/vals/${meta.id}`, {
142method: "PATCH",
143headers: {
160confirm(`File ${name} was deleted. Do you want to delete it on remote?`)
161) {
162await fetchValTown(`/v1/vals/${meta.id}`, { method: "DELETE" });
163delete lock[name];
164}
170171// remote -> local
172const { data: vals } = await fetchValTown(`/v1/users/${me.id}/vals`, {
173paginate: true,
174});
246}
247248const remoteEnv = await fetchEnv();
249const localEnv = existsSync("val-town.env")
250? dotenv.parse(Deno.readTextFileSync("val-town.env"))
umbrellaRemindermain.tsx2 matches
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";
14lon,
15});
16let { properties: { periods } } = await fetchJSON(
17grid.forecastHourly,
18);
tree_examplemain.tsx3 matches
8import { Hono } from "npm:hono";
910// The tree is fetched using an http request, so any http framework can be used
11const app = new Hono();
1249});
5051// this endpoint is used to dynamically fetch a list of tags from the api
52app.get("/tags/:tag", async (c) => {
53let { tag } = c.req.param();
85}
8687export default app.fetch;
88
jsoninvoicemain.tsx1 match
74});
7576export default app.fetch;
77