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/$%7Bsuccess?q=fetch&page=1055&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 13709 results for "fetch"(1803ms)

jokeGeneratorValmain.tsx4 matches

@naomizhang•Updated 7 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;

harmoniousBlackStoatmain.tsx4 matches

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

api_v1main.tsx1 match

@maxharper26•Updated 7 months ago
2
3// Define the HTTP val function
4export default async function fetchReturns(request: Request): Promise<Response> {
5 const databaseUrl = Deno.env.get("db_key_val_format");
6 if (!databaseUrl) {

stirringVioletHookwormmain.tsx1 match

@ryan_alive•Updated 7 months ago
41 `https://api.twitter.com/2/tweets/search/recent?query=${encodedQuery}&start_time=${since}&tweet.fields=author_id&expansions=author_id`;
42
43 const response = await fetch(url, {
44 headers: {
45 Authorization: `Bearer ${TWITTER_BEARER_TOKEN}`,

GitHubAPImain.tsx10 matches

@sharon•Updated 7 months ago
3
4 async getRepoContent(repo: string, path: string, branch: string) {
5 const response = await fetch(`https://api.github.com/repos/${repo}/contents/${path}?ref=${branch}`, {
6 method: 'GET',
7 headers: {
11
12 if (!response.ok) {
13 throw new Error(`Error fetching repo content: ${response.statusText}`);
14 }
15
18
19 async getFileSHA(repo: string, path: string, branch: string) {
20 const response = await fetch(`https://api.github.com/repos/${repo}/contents/${path}?ref=${branch}`, {
21 method: 'GET',
22 headers: {
26
27 if (!response.ok) {
28 throw new Error(`Error fetching file SHA: ${response.statusText}`);
29 }
30
34
35 async updateFile(repo: string, path: string, content: string, sha: string, message: string, branch: string) {
36 const response = await fetch(`https://api.github.com/repos/${repo}/contents/${path}`, {
37 method: 'PUT',
38 headers: {
68
69 try {
70 const response = await fetch(`${url}?ref=${branch}`, {
71 method: 'GET',
72 headers: {
81 }
82 } catch (error) {
83 console.error(`Error fetching file SHA: ${error.message}`);
84 }
85
86 const response = await fetch(url, {
87 method: 'PUT',
88 headers: {
104
105 async getCommitHistory(repo: string, path: string, branch: string) {
106 const response = await fetch(`https://api.github.com/repos/${repo}/commits?path=${path}&sha=${branch}`, {
107 method: 'GET',
108 headers: {
112
113 if (!response.ok) {
114 throw new Error(`Error fetching commit history: ${response.statusText}`);
115 }
116

dailyDadJokemain.tsx2 matches

@amitron•Updated 7 months ago
1import { email } from "https://esm.town/v/std/email";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
7 text: punchline,

isMyWebsiteDownmain.tsx2 matches

@amitron•Updated 7 months ago
14 start = performance.now();
15 try {
16 const res = await fetch(url);
17 end = performance.now();
18 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

sqliteExplorerAppmain.tsx4 matches

@janniks•Updated 7 months ago
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176
177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));

uptimemain.tsx2 matches

@sophie•Updated 7 months ago
11 const start = performance.now();
12 try {
13 const res = await fetch(url);
14 end = performance.now();
15 status = res.status;
22 } catch (e) {
23 end = performance.now();
24 reason = `couldn't fetch: ${e}`;
25 ok = false;
26 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

rss_feed_ai_analysismain.tsx7 matches

@vip•Updated 7 months ago
36
37 useEffect(() => {
38 fetchKeys();
39 }, []);
40
41 const fetchKeys = async () => {
42 try {
43 const response = await fetch("/keys");
44 if (!response.ok) {
45 throw new Error(`HTTP error! status: ${response.status}`);
48 setKeys(data.map(item => item.key));
49 } catch (e) {
50 setError(`Failed to fetch keys: ${e.message}`);
51 }
52 };
54 const handleKeyClick = async (key: string) => {
55 try {
56 const response = await fetch(`/feed/${encodeURIComponent(key)}`);
57 if (!response.ok) {
58 throw new Error(`HTTP error! status: ${response.status}`);
66 setError(null);
67 } catch (e) {
68 setError(`Failed to fetch feed: ${e.message}`);
69 }
70 };
75 setAnalysis(null);
76 setError(null);
77 const response = await fetch("/analyze", {
78 method: "POST",
79 headers: { "Content-Type": "application/json" },

FetchBasic2 file matches

@ther•Updated 2 days ago

GithubPRFetcher

@andybak•Updated 5 days ago