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=359&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 8056 results for "fetch"(787ms)

readJavascriptWeeklyRSSmain.tsx2 matches

@Skeye•Updated 2 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export default async function readJavascriptWeeklyRss() {
4 try {
5 const response = await fetch("https://cprss.s3.amazonaws.com/javascriptweekly.com.xml");
6 const xml = await response.text();
7 return xml;

API_Get_Weather_In_Frenchmain.tsx2 matches

@Skeye•Updated 2 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export default async function(req: Request): Promise<Response> {
7 const location = url.get("location");
8 if (url.has("location") && location) {
9 const weather = await fetchJSON(`https://wttr.in/${location}?format=j1&lang=fr`);
10 if (url.has("all")) {
11 return Response.json(weather);

InstantQueryApp1 match

@vawogbemi•Updated 2 months ago
25 const query = JSON.parse(results!);
26
27 // In a real application, you would use the query to fetch data from the database
28 // For this example, we'll just return the query itself
29 return new Response(JSON.stringify({ query, results: "Sample results would go here" }), {

cerebras_codermain.tsx1 match

@Pdrathod77•Updated 2 months ago
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({

InstantQuerygetSystemPrompt9 matches

@vawogbemi•Updated 2 months ago
5 Here is an example instantdb query (the examples use an unrelated database):
6
7 Fetch namespace
8 One of the simplest queries you can write is to simply get all entities of a namespace:
9 const query = { goals: {} };
10
11 Fetch multiple namespaces
12 You can fetch multiple namespaces at once:
13 const query = { goals: {}, todos: {} };
14
27 }
28
29 Fetch a specific entity
30 If you want to filter entities, you can use the where keyword. Here we fetch a specific goal:
31 const query = {
32 goals: {
55 }
56
57 Fetch associations
58 We can fetch goals and their related todos:
59
60 const query = {
74 }
75
76 Fetch associations for filtered namespace
77 We can fetch a specific entity in a namespace as well as it's related associations.
78
79 const query = {

statusmonitor2 matches

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

InstantQuerygetInstantSchema1 match

@vawogbemi•Updated 2 months ago
1async function getInstantSchema(instantAppId: string, instantAdminToken: string) {
2 const response = await fetch("https://api.instantdb.com/admin/schema", {
3 method: "GET",
4 headers: {

cerebras_codermain.tsx1 match

@Anmool•Updated 2 months ago
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({

humbleCoffeeMoosemain.tsx2 matches

@std•Updated 2 months ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import process from "node:process";
4
5export async function set(key: string, value: any) {
6 let resp = await fetch(
7 `${API_URL}/v1/vals`,
8 {

IPInfoExamplemain.tsx1 match

@charmaine•Updated 2 months ago
6 locationURL.searchParams.set("token", IPinfoToken);
7
8 const locationResponse = await fetch(locationURL.href);
9
10 return new Response(locationResponse.body);

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago