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=332&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 8288 results for "fetch"(777ms)

import_from_githubApp.tsx1 match

@shouser•Updated 1 month ago
25 }
26
27 const response = await fetch(`/import-github?url=${encodeURIComponent(projectUrl)}`, {
28 method: "POST",
29 headers: {

fiberplaneHonoZodStarterindex.ts1 match

@nbbaier•Updated 1 month ago
105});
106
107export default app.fetch;

alexBlogsindex.tsx1 match

@charmaine•Updated 1 month ago
29 const posts = files.filter((file) => file.path.startsWith("posts/"));
30 const postContents = await Promise.all(
31 posts.map(async (file) => await (await fetch(file.links.module)).text()),
32 );
33

andrewBlogsindex.tsx1 match

@charmaine•Updated 1 month ago
29 const posts = files.filter((file) => file.path.startsWith("posts/"));
30 const postContents = await Promise.all(
31 posts.map(async (file) => await (await fetch(file.links.module)).text()),
32 );
33

frontmain.tsx1 match

@tallesjp•Updated 1 month ago
26 try {
27 const fileContent = await file.text();
28 const response = await fetch('/process-file', {
29 method: 'POST',
30 headers: {

germinationmain.tsx1 match

@jpbrasile•Updated 1 month ago
39
40 try {
41 const response = await fetch("/submit", {
42 method: "POST",
43 headers: {

HTTP101HTTPguide7 matches

@willthereader•Updated 1 month ago
159 <h3>External Code</h3>
160
161 <h4>Fetch</h4>
162 <p>Fetch is a way for one server to request data from another server. A fetch requires
163 two const variables. The first is const response = await fetch(url). The second is
164 const data = await response.json();. If you want to do something besides just retrieve data,
165 you need to add the method. Change the first line from const response = await fetch(url) to
166 await fetch(url, {
167 method: 'any method except GET',
168 headers: { 'Content-Type': 'application/json' },
171
172 <p>
173 To make a fetch request with authorization, you would write const response = await fetch('API endpoint')
174 followed by const data = await response.json() and include headers: { 'Authorization': 'token' } in
175 your request.
195const app = new Hono();
196app.get("/", HTTP_Guide);
197export default app.fetch;

fiberplaneHonoZodStarterindex.ts1 match

@charmaine•Updated 1 month ago
105});
106
107export default app.fetch;

HONCindex.ts2 matches

@charmaine•Updated 1 month ago
63/**
64 * Wrap the incoming request, inject the Deno env vars into the Hono app,
65 * and then call the Hono api entrypoint (`app.fetch`)
66 */
67export default async function(req: Request): Promise<Response> {
74 //
75 // If you don't want those values, remove them from the env object
76 return app.fetch(req, env);
77}

get_random_jokemain.tsx5 matches

@ajax•Updated 1 month ago
1import { fetch } from "npm:node-fetch";
2
3export default async function(req: Request): Promise<Response> {
9
10 try {
11 const response = await fetch("https://official-joke-api.appspot.com/random_joke");
12 if (!response.ok) {
13 throw new Error("Failed to fetch joke");
14 }
15 const joke = await response.json();
16 return Response.json({ joke });
17 } catch (error) {
18 console.error("Error fetching joke:", error);
19 return Response.json({ error: "Failed to fetch joke" }, { status: 500 });
20 }
21}

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago