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?q=fetch&page=775&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 8325 results for "fetch"(3845ms)

spellCheckmain.tsx3 matches

@steveb1313•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function spellCheck(req: express.Request, res: express.Response) {
4 let response = await fetch("https://www.dnd5eapi.co/api/spells");
5 let data = await response.json();
6 let countOfSpells = data["count"];
7 let randomSpellNumber = Math.floor(Math.random() * countOfSpells);
8 let randomSpell = data["results"][randomSpellNumber];
9 let response2 = await fetch(
10 `https://www.dnd5eapi.co/api/spells/${randomSpell["index"]}`,
11 );

refresher_fetchermain.tsx1 match

@u•Updated 1 year ago
4import { refreshData } from "https://esm.town/v/u/refreshData";
5
6export async function refresher_fetcher() {
7 for (const [name, time] of Object.entries(
8 refreshData as Record<string, number>

openAQLocationmain.tsx2 matches

@tmcw•Updated 1 year ago
1import { msDay } from "https://esm.town/v/stevekrouse/msDay?v=1";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4export let openAQLocation = async ({
12 return q.charAt();
13 // Test
14 const { results } = fetchJSON(
15 "https://api.openaq.org/v2/locations?" +
16 new URLSearchParams({

redditNewmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { searchParams } from "https://esm.town/v/stevekrouse/searchParams";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export const redditNew = async ({ r, before }: { r: string, before?: string }) =>
5 fetchJSON(
6 `https://www.reddit.com/r/${r}/new/.json?${await searchParams(
7 { before }

hnSearchmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2import { searchParams } from "https://esm.town/v/stevekrouse/searchParams";
3
16 let type = search_by_date ? "search_by_date" : "search";
17 let cleaned_params = await searchParams(params);
18 let data = await fetchJSON(
19 `http://hn.algolia.com/api/v1/${type}?${cleaned_params}`
20 );

wikidatamain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function wikidata(sparql: string) {
4 return fetchJSON(
5 "https://query.wikidata.org/sparql" + "?query=" +
6 encodeURIComponent(sparql),

hnGetPostmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export let hnGetPost = (id) => fetchJSON(
4 `https://hacker-news.firebaseio.com/v0/item/${id}.json?print=pretty`
5)

discordChannelmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function discordChannel({ botToken, serverId }) {
4 return fetchJSON(
5 `https://discord.com/api/guilds/${serverId}/channels`,
6 {

addSendGridEmailmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3// called by supabase newsletter trigger (defined in sql editor)
4export let addSendGridEmail = ({ token, email, listId }) =>
5 fetchJSON("https://api.sendgrid.com/v3/marketing/contacts", {
6 method: "PUT",
7 headers: {

getWeatherByCoordsmain.tsx2 matches

@onemanwenttomow•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export async function getWeatherByCoords(lat, long) {
4 const weather = await fetchJSON(
5 `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${long}&hourly=temperature_2m,precipitation_probability&forecast_days=1`,
6 );

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago