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=785&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 8272 results for "fetch"(1417ms)

fetchFigmaFilemain.tsx4 matches

@rodrigotello•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function fetchFigmaFile(apiToken, fileKey) {
4 const url = `https://api.figma.com/v1/files/${fileKey}`;
5 const response = await fetch(url, {
6 headers: {
7 "X-FIGMA-TOKEN": apiToken,
9 });
10 if (!response.ok) {
11 console.error("Failed to fetch Figma file");
12 return null;
13 }

honoExamplemain.tsx1 match

@antonnyman•Updated 1 year ago
4 app.get("/", (c) => c.text("Hono?"));
5 app.get("/yeah", (c) => c.text("Routing!"));
6 return app.fetch(req);
7};

getValAsStringmain.tsx1 match

@liamdanielduffy•Updated 1 year ago
6 // 1. authorId
7 // 2. valName
8 // fetch(/getVal, params={authorId, valName})
9}

upscaleThisUrlmain.tsx3 matches

@liamdanielduffy•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
27 },
28 };
29 const result = await fetch(url, {
30 method: "POST",
31 headers: {
39 }
40 if (jobId) {
41 const result = await fetch(url + "/" + jobId, {
42 method: "GET",
43 headers: {

emailGithubReactionsmain.tsx3 matches

@vtdocs•Updated 1 year ago
3import { msAgo } from "https://esm.town/v/rodrigotello/msAgo?v=2";
4import { githubPatToken } from "https://esm.town/v/vtdocs/githubPatToken";
5import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
6
7export const emailGithubReactions = async () => {
8 const username = "stevekrouse";
9 const events = await fetchJSON(
10 `https://api.github.com/users/${username}/events?per_page=100`,
11 {
21 for (const comment of comments) {
22 for (
23 const reaction of await fetchJSON(
24 comment.payload.comment.reactions.url,
25 )

generateGuestbookSnippetmain.tsx2 matches

@vtdocs•Updated 1 year ago
12 const submitBtn = document.querySelector('#valtown-submit');
13 async function getMessages() {
14 const r = await fetch('https://${valUser}-${valName}.express.val.run');
15 msgList.innerHTML = '<ul>';
16 msgList.innerHTML += (await r.json()).map(msg => {
21 async function sendMessage() {
22 submitBtn.disabled = true
23 const r = await fetch('https://${valUser}-${valName}.express.val.run', {
24 method: 'POST',
25 headers: {

discordFetchmain.tsx3 matches

@vtdocs•Updated 1 year ago
1import { delay } from "https://esm.town/v/stevekrouse/delay?v=3";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4export const discordFetch = async (token, route, method = "GET", body = undefined) => {
5 let res;
6 while (true) {
7 res = await fetchJSON(
8 `https://discord.com/api${route}`,
9 {

resyVenueIdFromSlugAndCitymain.tsx2 matches

@vtdocs•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { resyPublicAPIKey } from "https://esm.town/v/vtdocs/resyPublicAPIKey";
3
9 id: number;
10}> => {
11 const venueRes = await fetch(
12 `https://api.resy.com/3/venue?url_slug=${slug}&location=${city}`,
13 {

weatherTestmain.tsx2 matches

@ktm•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function weatherTest(lat, long) {
5 const URL = `https://api.weather.gov/points/${lat},${long}`;
6 return URL;
7 const res = await fetch(URL);
8 const jsonData = await res.json();
9 console.log(jsonData.properties.timeZone);

callPrivateAPImain.tsx2 matches

@galligan•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export let callPrivateAPI = async ({ handle, val, method = "GET", secret }) => {
11 const valTownUrl = "https://api.val.town/v1/run/" + endpoint;
12 // Make an authenticated request to Val Town API
13 const response = await fetchJSON(valTownUrl, {
14 method,
15 headers: {

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago