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/?q=fetch&page=532&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 8481 results for "fetch"(1428ms)

cheerfulTanDeermain.tsx4 matches

@alexab123•Updated 6 months ago
6};
7
8// Fetches a random joke.
9async function fetchRandomJoke() {
10 const response = await fetch(
11 "https://official-joke-api.appspot.com/random_joke",
12 );
14}
15
16const randomJoke = await fetchRandomJoke();
17const setup = randomJoke.setup;
18const punchline = randomJoke.punchline;

umbrellaRemindermain.tsx2 matches

@mdgrech•Updated 6 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import { nominatimSearch } from "https://esm.town/v/stevekrouse/nominatimSearch";
4import { weatherGovGrid } from "https://esm.town/v/stevekrouse/weatherGovGrid";
14 lon,
15 });
16 let { properties: { periods } } = await fetchJSON(
17 grid.forecastHourly,
18 );

industriousEmeraldWhippetmain.tsx4 matches

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

jokeGeneratorValmain.tsx4 matches

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

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago