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/image-url.jpg%20%22Optional%20title%22?q=fetch&page=1237&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 13282 results for "fetch"(4875ms)

fetchDOEMenumain.tsx3 matches

@tal•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3// https://www.schools.nyc.gov/docs/default-source/school-menus/2023-2024/september/pre-k---8-express-hot-lunch-menu
4//
5export let fetchDOEMenu: (opts: {schoolYear: `${number}-${number}`, month: string, menuType: string}) = (async ({schoolYear, month, menuType}) => {
6 const resp = await fetch(
7 `https://www.schools.nyc.gov/docs/default-source/school-menus/${schoolYear}/${month}/${menuType}`,
8 {

shittyValTownUImain.tsx2 matches

@vez•Updated 1 year ago
8 isInterval?: boolean;
9 }) =>
10 `fetch('https://api.val.town/eval/@vez.editVal(${JSON.stringify(body)})')`;
11 return res.send(`<h1>Shitty Val Town 2</h1>
12${(await getAllVals("@vez")).map(({ code, name }) => {
13 const editorId = `${name}-editor`;
14 const onClick = `(document.getElementById('${name}-button').textContent = 'save 🔄'), fetch('https://api.val.town/eval/@vez.editVal', { method: 'POST', body: JSON.stringify({ name: '${name}', code: document.getElementById('${editorId}').value })}).then(()=>(document.getElementById('${name}-button').textContent = 'save ✅'))`;
15 return `<h2>${name}</h2>
16<textarea id="${editorId}" rows="20" cols="120">${escapeHtml(

postTweetmain.tsx2 matches

@andreterron•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export async function postTweet({ accessToken, text, reply }: {
8 };
9}) {
10 return fetchJSON(`https://api.twitter.com/2/tweets`, {
11 method: "POST",
12 headers: {

htmlExamplemain.tsx1 match

@olpy•Updated 1 year ago
36submitButton.addEventListener("click", async () => {
37 const webhookUrl = webhookUrlInput.value;
38 const response = await fetch(webhookUrl, {
39 method: "POST",
40 });

requestGoogleNgrammain.tsx2 matches

@bernat•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let requestGoogleNgram = async (
8 smoothing = 5,
9) => {
10 let response = await fetch(
11 `https://books.google.com/ngrams/json?content=${query}&year_start=${year_start}&year_end=${year_end}&corpus=${corpus}&smoothing=${smoothing}`,
12 ).then((p) => p.json());

wttrGetForecastmain.tsx2 matches

@smalldogenergy•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function wttrGetForecast({
7 const wttrLocation = encodeURIComponent(location);
8 const wttrLang = encodeURIComponent(languageCode);
9 const res = await fetch(
10 `https://wttr.in/${wttrLocation}?lang=${wttrLang}&format=j1`
11 );

createQuotePostmain.tsx1 match

@canpolat•Updated 1 year ago
14 const { LemmyHttp } = await import("npm:lemmy-js-client@0.18.1");
15 let client = new LemmyHttp(`https://${instance}`, {
16 fetchFunction: fetch,
17 });
18 const quote = unusedQuotes.pop();

dohRequestIpAddrmain.tsx2 matches

@serna•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function dohRequestIpAddr(domain) {
4 let req = await fetch(`https://1.1.1.1/dns-query?name=${domain}`, {
5 headers: { "Accept": "application/dns-json" },
6 });

testcase1main.tsx2 matches

@swyx•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/swyx/fetchJSON";
2
3export let testcase1 = fetchJSON('https://api.val.town/eval/@stevekrouse.messages')
4
5// export state = () => {

starWarsmain.tsx2 matches

@axel_sb•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Explore the Star Wars universe, from StarWarsAPI
4export let starWars = fetchJSON(
5 "https://swapi.dev/api/people/1/"
6);

GithubPRFetcher

@andybak•Updated 15 hours ago

proxiedfetch1 file match

@jayden•Updated 1 day ago