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/?q=fetch&page=610&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 8238 results for "fetch"(2110ms)

bookReservationOnResymain.tsx7 matches

@fshine99•Updated 10 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const bookReservationOnResy = async ({
145 )
146 }&password=${encodeURIComponent(params.password)}`;
147 const response = await fetch(`${RESY_API_URL}/3/auth/password`, {
148 method: "POST",
149 body: body,
167 }) => {
168 const url = `${RESY_API_URL}/3/details`;
169 const response = await fetch(url.toString(), {
170 method: "POST",
171 headers: RESY_DEFAULT_HEADERS,
192 searchParams.set("party_size", params.seats.toString());
193 searchParams.set("venue_id", params.venueId);
194 const response = await fetch(`${url}?${searchParams}`, {
195 method: "GET",
196 headers: RESY_DEFAULT_HEADERS,
212 searchParams.set("url_slug", params.slug);
213 searchParams.set("location", params.city);
214 const response = await fetch(`${url}?${searchParams}`, {
215 method: "GET",
216 headers: RESY_DEFAULT_HEADERS,
224 authToken: string;
225 }) => {
226 const response = await fetch(`${RESY_API_URL}/3/book`, {
227 method: "POST",
228 headers: {
252 venueId,
253 });
254 console.log("Fetched available slots for day", {
255 count: slots.length,
256 times: slots.map((slot) => `${slot.date.start} -> ${slot.date.end}`),

umbrellaRemindermain.tsx2 matches

@madhatter349•Updated 10 months 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 );

multiplayerCirclesmain.tsx2 matches

@Llad•Updated 10 months ago
86 const y = d3.select(this).attr("cy");
87
88 fetch(`/update?x=${x}&y=${y}&i=${d3.select(this).attr("idx")}`, { method: "post" });
89 d3.select(this).attr("stroke", null);
90 }
190 return new Response(body, { headers: { "Content-Type": "text/event-stream" } });
191});
192export default app.fetch;

blobmain.tsx4 matches

@natashatherobot•Updated 10 months ago
82async function list(prefix?: string): Promise<{ key: string; size: number; lastModified: string }[]> {
83 let querystring = prefix ? `?prefix=${encodeURIComponent(prefix)}` : "";
84 const res = await fetch(`${API_URL}/v1/blob${querystring}`, {
85 headers: {
86 Authorization: `Bearer ${Deno.env.get("valtown")}`,
95
96async function delete_(key: string) {
97 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
98 method: "DELETE",
99 headers: {
108
109async function get(key: string) {
110 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
111 headers: {
112 Authorization: `Bearer ${Deno.env.get("valtown")}`,
124
125async function set(key: string, value: BodyInit) {
126 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
127 method: "POST",
128 headers: {

blobbyFacemain.tsx15 matches

@rupello•Updated 10 months ago
2import { blobby } from "https://esm.town/v/yawnxyz/blobby";
3import { fileTypeFromBuffer } from 'npm:file-type';
4import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
5import { passwordAuth } from "https://esm.town/v/pomdtr/password_auth?v=74";
6
66
67
68// Endpoint to fetch blob by key
69app.get("/blob/:key", async (c) => {
70 const key = c.req.param('key');
193 this.blobs[key] = {isLoading: true};
194
195 const response = await fetch('/blob/' + key);
196 const contentType = response.headers.get('Content-Type');
197 blob.type = contentType || 'text/plain';
223 let blob = this.blobs[key];
224 try {
225 const response = await fetch('/create/' + key, {
226 method: 'POST',
227 headers: {
247
248 // Send a delete request to the server
249 const response = await fetch('/delete/' + key, { method: 'GET' });
250
251 // Check the response status
313
314 try {
315 const response = await fetch('/upload/' + key, {
316 method: 'POST',
317 body: formData,
338
339 try {
340 const response = await fetch('/uploadUrl' + '?key=' + key + '&url=' + url);
341
342 if (!response.ok) {
361 if (!this.newKeyName) return;
362 try {
363 const response = await fetch('/rename?key='+key+'&newKey='+this.newKeyName);
364 if (!response.ok) {
365 throw new Error('Failed to rename blob');
526 async loadBlob() {
527 this.isLoading = true;
528 const response = await fetch('/blob/' + this.key);
529 const contentType = response.headers.get('Content-Type');
530 this.blobType = contentType || 'text/plain';
550 async updateCreate() {
551 try {
552 const response = await fetch('/create/' + this.key, {
553 method: 'POST',
554 headers: {
573
574 try {
575 const response = await fetch('/upload/' + this.key, {
576 method: 'POST',
577 body: formData,
593 if (this.uploadUrl) {
594 try {
595 const response = await fetch('/uploadUrl?key=' + this.key + '&url=' + this.uploadUrl);
596
597 if (!response.ok) {
610 if (!this.newKeyName) return;
611 try {
612 const response = await fetch('/rename?key=' + this.key + '&newKey=' + this.newKeyName);
613 if (!response.ok) {
614 throw new Error('Failed to rename blob');
707
708
709// export default app.fetch;
710export default passwordAuth(app.fetch, {
711 // password: "123", // Deno.env.get("AUTH_TEST"),
712});

sqliteExplorerAppmain.tsx4 matches

@rupello•Updated 10 months ago
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176
177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));

staticChessmain.tsx2 matches

@tmcw•Updated 10 months ago
11
12 constructor() {}
13 async fetch(req: Request): Promise<Response> {
14 if (new URL(req.url).pathname === "/robots.txt") {
15 return new Response("User-agent: *\nDisallow: /");
232const sc = new StaticChess();
233
234export default analyticsHandlerWrapper(sc.fetch.bind(sc));

blobbyFacemain.tsx15 matches

@natashatherobot•Updated 10 months ago
1import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
2import { passwordAuth } from "https://esm.town/v/pomdtr/password_auth?v=74";
3import { blobby } from "https://esm.town/v/yawnxyz/blobby";
57}
58
59// Endpoint to fetch blob by key
60app.get("/blob/:key", async (c) => {
61 const key = c.req.param("key");
181 this.blobs[key] = {isLoading: true};
182
183 const response = await fetch('/blob/' + key);
184 const contentType = response.headers.get('Content-Type');
185 blob.type = contentType || 'text/plain';
211 let blob = this.blobs[key];
212 try {
213 const response = await fetch('/create/' + key, {
214 method: 'POST',
215 headers: {
235
236 // Send a delete request to the server
237 const response = await fetch('/delete/' + key, { method: 'GET' });
238
239 // Check the response status
301
302 try {
303 const response = await fetch('/upload/' + key, {
304 method: 'POST',
305 body: formData,
326
327 try {
328 const response = await fetch('/uploadUrl' + '?key=' + key + '&url=' + url);
329
330 if (!response.ok) {
349 if (!this.newKeyName) return;
350 try {
351 const response = await fetch('/rename?key='+key+'&newKey='+this.newKeyName);
352 if (!response.ok) {
353 throw new Error('Failed to rename blob');
512 async loadBlob() {
513 this.isLoading = true;
514 const response = await fetch('/blob/' + this.key);
515 const contentType = response.headers.get('Content-Type');
516 this.blobType = contentType || 'text/plain';
536 async updateCreate() {
537 try {
538 const response = await fetch('/create/' + this.key, {
539 method: 'POST',
540 headers: {
559
560 try {
561 const response = await fetch('/upload/' + this.key, {
562 method: 'POST',
563 body: formData,
579 if (this.uploadUrl) {
580 try {
581 const response = await fetch('/uploadUrl?key=' + this.key + '&url=' + this.uploadUrl);
582
583 if (!response.ok) {
596 if (!this.newKeyName) return;
597 try {
598 const response = await fetch('/rename?key=' + this.key + '&newKey=' + this.newKeyName);
599 if (!response.ok) {
600 throw new Error('Failed to rename blob');
685});
686
687// export default app.fetch;
688export default passwordAuth(app.fetch, {
689 // password: "123", // Deno.env.get("AUTH_TEST"),
690});

seiveDubbingmain.tsx2 matches

@mux•Updated 10 months ago
107 },
108 };
109 const req = await fetch("https://mango.sievedata.com/v2/push", {
110 method: "POST",
111 body: JSON.stringify(payload),
120
121async function pollDubbingJob(jobId) {
122 const req = await fetch(`https://mango.sievedata.com/v2/jobs/${jobId}`, {
123 headers: {
124 "X-API-Key": SIEVE_API_KEY,

hnResumemain.tsx2 matches

@cw12•Updated 10 months ago
6 const hnStoryURL = "https://hacker-news.firebaseio.com/v0/item/";
7
8 const topStories = await fetch(hnTopStoriesURL).then((res) => res.json());
9 const firstFive = topStories.slice(0, 50);
10 const stories = await Promise.all(
11 firstFive.map((id: number) => fetch(`${hnStoryURL}${id}.json`).then((res) => res.json())),
12 );
13

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago