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=714&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 8158 results for "fetch"(3202ms)

githubEventsmain.tsx2 matches

@endingwithali•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// GitHub events
4export let githubEvents = fetchJSON(
5 "https://api.github.com/users/stevekrouse/events"
6);

fetchWeatherPredictionmain.tsx8 matches

@jamiedubs•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const fetchWeatherPrediction = async (req: Request) => {
4 interface Forecast {
5 startTime: string;
14 };
15 }
16 async function fetchForecast(
17 latitude: number,
18 longitude: number,
19 ): Promise<Forecast[]> {
20 try {
21 // Fetch the points data to get the forecast endpoint
22 const pointsUrl: string =
23 `https://api.weather.gov/points/${latitude},${longitude}`;
24 console.log(pointsUrl);
25 const pointsResponse = await fetch(pointsUrl, {
26 headers: { "Accept": "application/geo+json" },
27 });
29 const pointsData = await pointsResponse.json();
30 const forecastUrl: string = pointsData.properties.forecast;
31 // Fetch the actual forecast
32 const forecastResponse = await fetch(forecastUrl, {
33 headers: { "Accept": "application/geo+json" },
34 });
54 // don't really need names either
55 // would be nice to convert name to lat/lng
56 const forecast = await fetchForecast(lat, lng);
57 console.log(`Forecast for ${placeName} @ ${lat},${lng}`);
58 forecast.forEach((period) => {

getChatgptmain.tsx2 matches

@bingo16•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
21
22 const getCompelitoins = async (data) => {
23 const response = await fetch("https://api.openai.com/v1/completions", {
24 method: "POST",
25 headers: {

randmain.tsx2 matches

@envl•Updated 1 year ago
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
2
3export const rand = () =>
4 fetchText("http://numbersapi.com/random/math");

fetchCongressTradeReportsmain.tsx4 matches

@rodrigotello•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3/**
5 Receive daily emails of reported congress trades by scheduling a call to
6
7 @claytn.fetchCongressTradeReports((reports) => console.email(reports))
8*/
9
10
11export async function fetchCongressTradeReports(callback) {
12 const res = await fetchJSON(
13 "https://bff.capitoltrades.com/trades?sortBy=-pubDate"
14 );

csvToJsonmain.tsx2 matches

@aeaton•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const csvToJson = async (url: string) => {
14 url =
15 "https://www.ncbi.nlm.nih.gov/core/assets/pmc/files/removed_phe_articles_oa_subset.csv";
16 const response = await fetch(url);
17 const stream = response.body?.pipeThrough(textDecoder)
18 .pipeThrough(csvParser).pipeThrough(jsonStringifier).pipeThrough(

scheduleExamplemain.tsx2 matches

@neverstew•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const scheduleExample = () => fetch("example.com");

alphaVantageSymbolQuerymain.tsx2 matches

@sean•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/sean/fetchJSON";
2import { toQueryString } from "https://esm.town/v/sean/toQueryString";
3
27
28 try {
29 const json = await fetchJSON(
30 `https://${API_HOST}/query?${queryString}`,
31 {

boredActivitiesmain.tsx2 matches

@ddpopbb3•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Activity suggestions for when you're bored
4export let boredActivities = fetchJSON(
5 "https://www.boredapi.com/api/activity",
6);

nowCastPMAQImain.tsx2 matches

@stungeye•Updated 1 year ago
1import { nowcastPMAqi } from "https://esm.town/v/stevekrouse/nowcastPMAqi?v=6";
2import { msHour } from "https://esm.town/v/stevekrouse/msHour?v=1";
3import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
4
5export async function nowCastPMAQI({ location_id }) {
6 const { results } = await fetchJSON(
7 "https://api.openaq.org/v2/measurements?" +
8 new URLSearchParams({

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago