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=461&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 7868 results for "fetch"(936ms)

big5PersonalityTestmain.tsx6 matches

@manyone•Updated 5 months ago
17 ];
18
19 // Endpoint to fetch questions
20 if (new URL(request.url).pathname === '/questions') {
21 return new Response(JSON.stringify(defaultQuestions), {
284
285 function completeQuiz() {
286 fetch('/submit', {
287 method: 'POST',
288 headers: { 'Content-Type': 'application/json' },
358
359 startButton.addEventListener('click', function() {
360 // Use absolute URL for fetching questions
361 fetch(window.location.origin + '/questions')
362 .then(function(response) {
363 console.log('Fetch response status:', response.status);
364 if (!response.ok) {
365 throw new Error('Network response was not ok');
375 })
376 .catch(function(error) {
377 logError('Error fetching questions', error);
378 });
379 });

createMovieSitemain.tsx6 matches

@temptemp•Updated 5 months ago
4const app = new Hono();
5
6async function fetchMovies(page = 1, limit = 20) {
7 const cacheKey = `movies_page_${page}_limit_${limit}`;
8
12 return cachedResponse;
13 }
14 const apiResponse = await fetch(
15 `https://api.zoechip.to/data/browse/?lang=3&keyword=&year=&rating=&votes=&genre=&country=&cast=&directors=&type=&order_by=trending&page=${page}&limit=${limit}`,
16 {
33 return data;
34 } catch (error) {
35 console.error("Failed to fetch movies:", error);
36 return { movies: [], pager: { totalPages: 0, currentPage: 1 } };
37 }
51app.get("/", async (c) => {
52 const page = Number(c.req.query("page") || "1");
53 const { movies, pager } = await fetchMovies(page);
54
55 return c.html(`
209app.get("/movie/:id", async (c) => {
210 const movieId = c.req.param("id");
211 const { movies } = await fetchMovies();
212 const movie = movies.find(m => m._id === movieId);
213
276});
277
278export default app.fetch;

valuableLavenderOpossummain.tsx4 matches

@ayaanpatel1790•Updated 5 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;

libsqlstudiomain.tsx1 match

@spinningideas•Updated 5 months ago
4const app = createApp();
5
6export default lastlogin(app.fetch, {
7 verifyEmail: (email) => email === "spinningidea@gmail.com",
8});

getWeathermain.tsx2 matches

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

cerebras_codermain.tsx1 match

@joyboy•Updated 5 months ago
23
24 try {
25 const response = await fetch("/", {
26 method: "POST",
27 body: JSON.stringify({ prompt, currentCode: code }),

exceptionalBlueMockingbirdmain.tsx4 matches

@elise_if•Updated 5 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke:
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;

pageshotmain.tsx3 matches

@yawnxyz•Updated 5 months ago
64
65 console.log(">>>> Data", data)
66 const response = await fetch(pipeline_url, {
67 method: "POST",
68 headers: {
302 }
303
304 const response = await fetch('/pageshot', {
305 method: 'POST',
306 headers: {
559app.post("/pageshot", pageshotHandler);
560
561export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
562

deepLTranslatorAppmain.tsx2 matches

@sky_porie_fire443•Updated 5 months ago
34
35 try {
36 const response = await fetch("/translate", {
37 method: "POST",
38 headers: {
214
215 // 使用开放的翻译API作为备选方案
216 const translationResponse = await fetch(
217 `https://translate.googleapis.com/translate_a/single?client=gtx&sl=${source_lang === 'auto' ? 'auto' : source_lang}&tl=${target_lang}&dt=t&q=${encodeURIComponent(text)}`,
218 {

yc_findermain.tsx5 matches

@stevekrouse•Updated 5 months ago
62
63 useEffect(() => {
64 const fetchYCCompanies = async () => {
65 const storedCompanies = localStorage.getItem("ycCompanies");
66 if (storedCompanies) {
69 setDebugInfo(prevInfo => prevInfo + `\nLoaded ${companies.length} companies from localStorage`);
70 } else {
71 const response = await fetch("/companies.json");
72 const companies = await response.json();
73 setYcCompanies(companies);
74 localStorage.setItem("ycCompanies", JSON.stringify(companies));
75 setDebugInfo(prevInfo =>
76 prevInfo + `\nFetched ${companies.length} companies from server and stored in localStorage`
77 );
78 }
79 };
80 fetchYCCompanies();
81 }, []);
82
226
227export default async function server(request: Request): Promise<Response> {
228 const companies = await fetch("https://stevekrouse-yc_database.web.val.run").then(res => res.json());
229 const url = new URL(request.url);
230 if (url.pathname === "/companies.json") {

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago