Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7Bsuccess?q=fetch&page=683&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 8656 results for "fetch"(1611ms)

harlequinCobramain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export async function getWeather(city: string): Promise<WeatherResponse> {
4 return fetchJSON(`https://wttr.in/${city}?format=j1`);
5}
6

kyselyVtTypesmain.tsx1 match

@pomdtr•Updated 1 year ago
55 "embed",
56 "document",
57 ].includes(req.headers.get("sec-fetch-dest"))
58 )
59 return new Response(

pipesmain.tsx1 match

@pomdtr•Updated 1 year ago
16 const pathname = `/api/latest/user/${user}/workspace/${workspace}/query`;
17
18 const resp = await fetch(`${origin}${pathname}?sql=${encodeURIComponent(sql)}`, {
19 headers: {
20 Authorization: `Bearer ${Deno.env.get("PIPES_TOKEN")}`,

aiREADME.md1 match

@yawnxyz•Updated 1 year ago
12
13 try {
14 const response = await fetch(url);
15 const data = await response.json();
16 return data;

bookmarkmain.tsx1 match

@michaelmang•Updated 1 year ago
111});
112
113export default app.fetch;

syncmain.tsx11 matches

@pomdtr•Updated 1 year ago
10}
11
12export async function fetchEnv() {
13 const { data: res, error } = await fetchValTown("/v1/eval", {
14 method: "POST",
15 body: JSON.stringify({
28}
29
30export async function fetchValTown<T = any>(
31 path: string,
32 options?: RequestInit & {
45
46 while (true) {
47 const resp = await fetch(url, {
48 headers,
49 });
68 }
69
70 const resp = await fetch(`${apiURL}${path}`, {
71 ...options,
72 headers,
96 : {};
97
98const { data: me } = await fetchValTown("/v1/me");
99const valDir = path.join(Deno.cwd(), me.username);
100if (!existsSync(valDir)) {
112 confirm(`A new val ${file} was found. Do you want to create it on remote?`)
113 ) {
114 const { data } = await fetchValTown("/v1/vals", {
115 method: "POST",
116 headers: {
139
140 if (confirm(`File ${file} has changed. Do you want to update it on remote?`)) {
141 await fetchValTown(`/v1/vals/${meta.id}`, {
142 method: "PATCH",
143 headers: {
160 confirm(`File ${name} was deleted. Do you want to delete it on remote?`)
161 ) {
162 await fetchValTown(`/v1/vals/${meta.id}`, { method: "DELETE" });
163 delete lock[name];
164 }
170
171// remote -> local
172const { data: vals } = await fetchValTown(`/v1/users/${me.id}/vals`, {
173 paginate: true,
174});
246}
247
248const remoteEnv = await fetchEnv();
249const localEnv = existsSync("val-town.env")
250 ? dotenv.parse(Deno.readTextFileSync("val-town.env"))

umbrellaRemindermain.tsx2 matches

@michaelmang•Updated 1 year ago
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 );

tree_examplemain.tsx3 matches

@pomdtr•Updated 1 year ago
8import { Hono } from "npm:hono";
9
10// The tree is fetched using an http request, so any http framework can be used
11const app = new Hono();
12
49});
50
51// this endpoint is used to dynamically fetch a list of tags from the api
52app.get("/tags/:tag", async (c) => {
53 let { tag } = c.req.param();
85}
86
87export default app.fetch;
88

blog_mdxmain.tsx1 match

@pomdtr•Updated 1 year ago
108});
109
110export default app.fetch;
111

jsoninvoicemain.tsx1 match

@pomdtr•Updated 1 year ago
74});
75
76export default app.fetch;
77

fetchPaginatedData2 file matches

@nbbaier•Updated 3 weeks ago

FetchBasic1 file match

@fredmoon•Updated 3 weeks ago