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=api&page=478&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 5056 results for "api"(400ms)

aqiLocationmain.tsx1 match

@stevekrouse•Updated 1 year ago
5export let aqiLocation = async ({ lat, lon }: { lat: number; lon: number }) => {
6 const { results } = fetchJSON(
7 "https://api.openaq.org/v2/locations?" +
8 new URLSearchParams({
9 limit: "10",

basicAPIExmain.tsx4 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3// accessible via API at https://api.val.town/eval/@stevekrouse.basicAPIEx
4export const basicAPIEx = fetchJSON(
5 "https://date.nager.at/api/v2/publicholidays/2023/US"
6);
7// Bonus: the whole runtime is available in the URL Bar 🤯
8// ie https://api.val.town/eval/"The first holiday is "+ @stevekrouse.basicAPIEx[0].name

valBeeExamplemain.tsx1 match

@stevekrouse•Updated 1 year ago
4export const valBeeExample = async () => {
5 return (valbeeTest = fetchText(
6 "http://numbersapi.com/random/math"
7 ));
8};

twitterUsermain.tsx2 matches

@stevekrouse•Updated 1 year ago
12 twitterJSON({
13 url: handle
14 ? `https://api.twitter.com/2/users/by/username/${handle}`
15 : `https://api.twitter.com/2/users/${id}`,
16 bearerToken,
17 });

discordGetChannelsmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { discordAPI } from "https://esm.town/v/stevekrouse/discordAPI";
2
3// https://discord.com/developers/docs/resources/guild#get-guild-channels
4export let discordGetChannels = ({token, tokenType, guildId}) => discordAPI({
5 token,
6 tokenType,

unauthenticatedCantMutatemain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { testMutateSemantics } from "https://esm.town/v/stevekrouse/testMutateSemantics";
2
3export const unauthenticatedCantMutate = (api) =>
4 testMutateSemantics({
5 stateName: "@stevekrouse.testState",
6 api,
7 mutateExpected: false,
8 mutator: (now) => `@stevekrouse.testState = ${now}`,

badArgs1main.tsx3 matches

@stevekrouse•Updated 1 year ago
5 console.log(
6 await fetchText(
7 "https://api.val.town/v1/run/stevekrouse.id",
8 {
9 method: "POST",
15 console.log(
16 await fetchText(
17 "https://api.val.town/v1/run/stevekrouse.id",
18 {
19 method: "POST",
27 console.log(
28 await fetchText(
29 "https://api.val.town/v1/run/stevekrouse.id",
30 {
31 method: "POST",

hasValTownStyleGuideUpdatedmain.tsx1 match

@stevekrouse•Updated 1 year ago
5export let hasValTownStyleGuideUpdated = async (since: Date) => {
6 let commits = await fetchJSON(
7 "https://api.github.com/repos/val-town/val.town/commits?path=/src/style.tsx&since=" +
8 since.toISOString(),
9 {

dsnyEventsFeedmain.tsx1 match

@tmcw•Updated 1 year ago
4 const ics = await import("npm:ics");
5 const events = await fetch(
6 "https://a827-donatenyc.nyc.gov/DSNYApi/api/Events/GetAllByBorough?borough=",
7 )
8 .then((r) => r.json());

chessTimemain.tsx1 match

@tmcw•Updated 1 year ago
3export let chessTime = (async () => {
4 const { secondsToHours } = await import("npm:date-fns");
5 const stats = await fetch("https://lichess.org/api/user/tmcw").then((r) =>
6 r.json()
7 );

runValAPIEx2 file matches

@charmaine•Updated 10 hours ago

PassphraseAPI2 file matches

@wolf•Updated 3 days ago
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com
fiberplane
Purveyors of Hono tooling, API Playground enthusiasts, and creators of 🪿 HONC 🪿 (https://honc.dev)