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=201&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 2746 results for "fetch"(438ms)

HTTP101POSTrequestFormGuide1 match

@willthereader•Updated 1 month ago
131const app = new Hono();
132app.get("/", HTTP_Guide);
133export default app.fetch;
134
135// <p> </p>

utilsindex.ts2 matches

@alexwein•Updated 1 month ago
1import { fetchTranspiledJavaScript, listFiles, readFile } from "./file/index.ts";
2import { parseProject } from "./parseImportMeta/project.ts";
3import { getContentType, serveFile } from "./serve-file/index.ts";
4import { testServer } from "./test/index.tsx";
5
6export { fetchTranspiledJavaScript, getContentType, listFiles, parseProject, readFile, serveFile };

utilsindex.ts5 matches

@alexwein•Updated 1 month ago
8 let text;
9 try {
10 text = await fetchTranspiledJavaScript(esmURL);
11 } catch (err) {
12 throw new Error("Failed to fetch file " + esmURL);
13 }
14 return text;
35}
36
37export async function fetchTranspiledJavaScript(url: string) {
38 const res = await fetch(url, {
39 headers: {
40 // Always transpile TS to JS
44 });
45 if (!res.ok) {
46 throw new Error("Failed to fetch " + url);
47 }
48 return await res.text();

HTTP101PUT5 matches

@willthereader•Updated 1 month ago
27 <a href="https://github.com/wkrouse">Github</a>
28 </nav>
29 <h1>How to make a PUT request with the Fetch API</h1>
30 <p> This page is a guide on how to PUT request with the Fetch API. First I'm going to
31 explain what why we're using the Fetch API. Then I'll explain what it is and the Val Town variant.
32 Finally I'll walk you through modifying the code example so that it allows you to replacing name with a
33 different name.</p>
34
35 <p>The reason we need to use the Fetch API is that the HTML form only works
36 for GET and POST methods. </p>
37
48const app = new Hono();
49app.get("/", HTTP_Guide);
50export default app.fetch;
51
52// <p> </p>
askSMHI

askSMHIservice1 match

@ljus•Updated 1 month ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3import { offset, removeOffset } from "npm:@formkit/tempo";
askSMHI

askSMHIservice2 matches

@ljus•Updated 1 month ago
1import { offset, removeOffset } from "npm:@formkit/tempo";
2import { fetchWeatherAtCoordinate } from "./fetcher";
3export async function getWeatherAtCoordinate(
4 lon: number,
16 const fromstr = new Date(startOfDay).toISOString();
17 const tostr = new Date(endOfDay).toISOString();
18 const weatherData = await fetchWeatherAtCoordinate(lon, lat);
19 if (!weatherData) {
20 return null;
askSMHI

askSMHIfetcher3 matches

@ljus•Updated 1 month ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import * as v from "npm:valibot";
3import { describePcat, describeWeatherSymbolCode } from "./describe";
4
5export async function fetchWeatherAtCoordinate(lon: number, lat: number) {
6 if (!lon || isNaN(lon)) {
7 return null;
10 return null;
11 }
12 const response = await fetch(
13 `https://opendata-download-metfcst.smhi.se/api/category/pmp3g/version/2/geotype/point/lon/${lon}/lat/${lat}/data.json`,
14 );
askSMHI

askSMHImoderation1 match

@ljus•Updated 1 month ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3import { OpenAI } from "npm:openai";

newCerebrasModelAlertmain.tsx2 matches

@stevekrouse•Updated 1 month ago
1import { blob } from "https://esm.town/v/std/blob?v=13";
2import { email } from "https://esm.town/v/std/email?v=13";
3import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
4
5export default async function(interval: Interval) {
7 const historicalModels = await blob.getJSON("cerebras-models.json");
8
9 const currentModels = await fetchJSON("https://api.cerebras.ai/v1/models", {
10 bearer: Deno.env.get("CEREBRAS_API_KEY"),
11 });

emojiExplodermain.tsx1 match

@stevekrouse•Updated 1 month ago
108// });
109
110// export default app.fetch;
111export default () => Response.json("Broken import, sad");

fetchPaginatedData2 file matches

@nbbaier•Updated 6 days ago

tweetFetcher2 file matches

@nbbaier•Updated 1 week ago