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%22Image%20title%22?q=fetch&page=1122&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 13558 results for "fetch"(5427ms)

blobCommentsReactmain.tsx5 matches

@keenanzucker•Updated 10 months ago
10
11 useEffect(() => {
12 async function fetchSchedule() {
13 await fetch("/schedule")
14 .then(response => {
15 return response.json();
21 }
22
23 fetchSchedule();
24 }, []);
25
62 const tomorrow = new Date(today);
63 tomorrow.setDate(tomorrow.getDate() + 1);
64 const data = await fetch(
65 `https://api.stage.teamsurfboard.com/api/v1/schedule?start=${today.toISOString()}&end=${tomorrow.toISOString()}`,
66 {
76});
77
78export default app.fetch;

codeOnValTownmain.tsx3 matches

@andreterron•Updated 10 months ago
37
38/**
39 * @param handler Fetch handler
40 * @param val Define which val should open
41 */
42export function modifyFetchHandler(
43 handler: (req: Request) => Response | Promise<Response>,
44 { val, style }: { val?: ValRef; style?: string } = {},
52}
53
54export default modifyFetchHandler;

surfboardDemoSchedule2main.tsx2 matches

@keenanzucker•Updated 10 months ago
8 const tomorrow = new Date(today);
9 tomorrow.setDate(tomorrow.getDate() + 1);
10 const data = await fetch(
11 `https://api.stage.teamsurfboard.com/api/v1/schedule?start=${today.toISOString()}&end=${tomorrow.toISOString()}`,
12 {
36};
37function Schedule({ data }) {
38 if (!data) return <p>Failed to fetch</p>;
39
40 const [hours, setHours] = useState(10);

sourceOnGithubExamplemain.tsx1 match

@curtcox•Updated 10 months ago
28});
29
30export default app.fetch;

openaiproxymain.tsx2 matches

@mmrech•Updated 10 months ago
27 const authHeader = req.headers.get("Proxy-Authorization") || req.headers.get("Authorization");
28 const token = authHeader ? parseBearerString(authHeader) : undefined;
29 const meRes = await fetch(`${API_URL}/v1/me`, { headers: { Authorization: `Bearer ${token}` } });
30 if (!meRes.ok) {
31 return new Response("Unauthorized", { status: 401 });
62 });
63
64 const openAIRes = await fetch(url, {
65 method: req.method,
66 headers,

dependencyLicensesmain.tsx8 matches

@kylem•Updated 10 months ago
16}
17
18// Function to fetch package info from NPM registry
19async function fetchPackageInfo(packageName: string) {
20 const url = `https://registry.npmjs.org/${packageName}`;
21 const response = await fetch(url);
22 if (!response.ok) {
23 throw new Error(`Failed to fetch package info for ${packageName}`);
24 }
25 return response.json();
70async function checkPackageLicenses(packageJsonUrl: string): Promise<{ licenses: PackageLicense[]; repoName: string }> {
71 try {
72 const response = await fetch(packageJsonUrl);
73 if (!response.ok) {
74 throw new Error(`Failed to fetch package.json from ${packageJsonUrl}`);
75 }
76 const packageJson: PackageJson = await response.json();
83 for (const [name, version] of Object.entries(dependencies)) {
84 try {
85 const packageInfo = await fetchPackageInfo(name);
86 const license = extractLicenseInfo(packageInfo);
87 const repoUrl = extractGitHubRepoUrl(packageInfo);
165});
166
167export default app.fetch;

gitReleaseNotesmain.tsx11 matches

@kylem•Updated 10 months ago
16}
17
18// Function to fetch package info from NPM registry
19async function fetchPackageInfo(packageName: string) {
20 const url = `https://registry.npmjs.org/${packageName}`;
21 const response = await fetch(url);
22 if (!response.ok) {
23 throw new Error(`Failed to fetch package info for ${packageName}`);
24 }
25 return response.json();
45
46async function getGithubReleases(repo: string): Promise<GithubRelease[]> {
47 const response = await fetch(`https://api.github.com/repos/${repo}/releases`);
48 if (!response.ok) {
49 throw new Error(`Failed to fetch releases from ${repo}`);
50 }
51 return response.json();
76async function checkNpmUpdates(packageJsonUrl: string): Promise<string> {
77 try {
78 const response = await fetch(packageJsonUrl);
79 if (!response.ok) {
80 throw new Error(`Failed to fetch package.json from ${packageJsonUrl}`);
81 }
82 const packageJson: PackageJson = await response.json();
89 for (const [name, version] of Object.entries(dependencies)) {
90 try {
91 const packageInfo = await fetchPackageInfo(name);
92 const repoUrl = extractGitHubRepoUrl(packageInfo);
93 if (!repoUrl) {
114 for (const [name, version] of Object.entries(devDependencies)) {
115 try {
116 const packageInfo = await fetchPackageInfo(name);
117 const repoUrl = extractGitHubRepoUrl(packageInfo);
118 if (!repoUrl) {
178});
179
180export default app.fetch;

infiniteSVGGraphmain.tsx3 matches

@maxm•Updated 10 months ago
90 prompt = document.getElementById("svgInput").value;
91 }
92 let resp = await fetch("/remix/" + id, { method: "POST", body: JSON.stringify({ prompt }) });
93 const reader = resp.body.getReader();
94 const decoder = new TextDecoder();
139 const buttonContainer = button.closest(".heart-button-container");
140 const buttonRect = button.getBoundingClientRect();
141 fetch(`/${button.attributes["data-id"].value}/heart`, { method: "POST" });
142 for (let i = 0; i < 10; i++) {
143 const heart = document.createElement("div");
516 return c.text("OK");
517});
518export default app.fetch;

discordBotmain.tsx2 matches

@augustveix•Updated 10 months ago
1import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4export type Snowflake = string;
95 (async () => {
96 const data = await response;
97 const update = await fetch(
98 `https://discord.com/api/v10/webhooks/${body.application_id}/${body.token}/messages/@original`,
99 {

codeOnValTownmain.tsx3 matches

@stevekrouse•Updated 10 months ago
37
38/**
39 * @param handler Fetch handler
40 * @param val Define which val should open
41 */
42export function modifyFetchHandler(
43 handler: (req: Request) => Response | Promise<Response>,
44 { val, style }: { val?: ValRef; style?: string } = {},
52}
53
54export default modifyFetchHandler;

GithubPRFetcher

@andybak•Updated 2 days ago

proxiedfetch1 file match

@jayden•Updated 3 days ago