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=575&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 7881 results for "fetch"(1244ms)

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

sqliteExplorerAppmain.tsx4 matches

@amotivv•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 })));

createValVersionmain.tsx2 matches

@neverstew•Updated 10 months ago
1// my inserted comment
2 import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4export function createValVersion({ token, valId, code }: {
26 referenceCount: number;
27}> {
28 return fetchJSON(
29 `https://api.val.town/v1/vals/${valId}/versions`,
30 {

pingNationsmain.tsx1 match

@bohaska•Updated 10 months ago
16 const myHeaders = new Headers(httpHeaders);
17 console.log("Starting...");
18 let response = await fetch(
19 `https://www.nationstates.net/cgi-bin/api.cgi?nation=${nations[i]}&q=issues`,
20 {

blob_adminmain.tsx2 matches

@amotivv•Updated 10 months ago
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
133});
134
135export default modifyFetchHandler(passwordAuth(app.fetch));

nationstatesSentimentAImain.tsx3 matches

@bohaska•Updated 10 months ago
10
11async function query(data) {
12 const response = await fetch(
13 "https://api-inference.huggingface.co/models/cardiffnlp/twitter-roberta-base-sentiment-latest",
14 {
33 const myHeaders = new Headers(httpHeaders);
34 console.log("Starting...");
35 let response = await fetch(
36 `https://www.nationstates.net/cgi-bin/api.cgi?nation=${Deno.env.get("NATION_ID")}&q=issues`,
37 {
70 await Promise.all(optionPromises);
71
72 let execute_issue = await fetch(
73 `https://www.nationstates.net/cgi-bin/api.cgi?nation=${
74 Deno.env.get("NATION_ID")

test_explorermain.tsx1 match

@maxm•Updated 10 months ago
3export { Test } from "https://esm.town/v/pomdtr/test";
4
5export default router.fetch;

dubLinkMakermain.tsx2 matches

@mux•Updated 10 months ago
57 // If the destination is `list`, return a list of all the existing short links
58 if (destination === "list") {
59 const req = await fetch(`https://api.dub.co/links?workspaceId=${dubWorkspaceId}`, {
60 headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
61 });
84
85 try {
86 const resp = await fetch(`https://api.dub.co/links?workspaceId=${dubWorkspaceId}`, options).then(
87 response => response.json(),
88 );

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago