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=475&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 5057 results for "api"(455ms)

authRequestExmain.tsx3 matches

@stevekrouse•Updated 1 year ago
1import { exportedKeys } from "https://esm.town/v/stevekrouse/exportedKeys";
2import { runValAPIAuth } from "https://esm.town/v/stevekrouse/runValAPIAuth";
3
4export const authRequestEx = runValAPIAuth({
5 val: "@stevekrouse.exampleAuthApi",
6 args: [1, 3],
7 keys: exportedKeys,

limitmain.tsx1 match

@stevekrouse•Updated 1 year ago
46 //
47 const limit = await fetchJSON(
48 `https://api.rlimit.com/limit/${namespaceId}/${type}/${max}/${interval}/${key}?cost=${cost}&subNamespace=${subNamespace}&password=${pass}`,
49 );
50 return limit;

getPublicValsmain.tsx2 matches

@stevekrouse•Updated 1 year ago
3export const getPublicVals = async (username) => {
4 let { id } = await fetchJSON(
5 `https://api.val.town/v1/alias/${username}`,
6 );
7 return fetchJSON(
8 `https://api.val.town/v1/users/${id}/vals`,
9 );
10};

testMutateSemantics2main.tsx4 matches

@stevekrouse•Updated 1 year ago
1import { TEST_API } from "https://esm.town/v/stevekrouse/TEST_API";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
16}) {
17 const { data: last } = await fetchJSON(
18 `${TEST_API}/eval/${stateName}`
19 );
20 const now = Date.now();
21 await fetchJSON(
22 `${TEST_API}/eval/${mutator(now)}`
23 );
24 const { data: next } = await fetchJSON(
25 `${TEST_API}/eval/${stateName}`
26 );
27 const mutated = next === now;

measureValTownE2emain.tsx2 matches

@tmcw•Updated 1 year ago
8 for (let i = 0; i < count; i++) {
9 let start = Date.now();
10 await fetch("https://api.val.town/eval/(()=%3E1+1)()");
11 evalTimes.push(Date.now() - start);
12 }
23 for (let i = 0; i < count; i++) {
24 let start = Date.now();
25 await fetch("https://api.val.town/eval/@healeycodes.addOnes()");
26 userFuncTimes.push(Date.now() - start);
27 }

githubFollowingmain.tsx1 match

@tmcw•Updated 1 year ago
5 throw new Error(`${fetchJSON.impl.toString()}`);
6 return fetchJSON(
7 "https://api.github.com/users/stevekrouse/following"
8 );
9})();

jsYAMLExamplemain.tsx1 match

@tmcw•Updated 1 year ago
6 // Fetch a YAML file
7 const yaml = await fetch(
8 "https://raw.githubusercontent.com/docker/engine/8955d8da8951695a98eb7e15bead19d402c6eb27/api/swagger.yaml",
9 ).then((r) => r.text());
10 // parse the fetched file
5 const response =
6 (await fetch(
7 "https://api.val.town/v1/run/politelyinvinciblepointer.handleForm",
8 {
9 method: "POST",

checkIfTwitterAPIIsDownmain.tsx10 matches

@stevekrouse•Updated 1 year ago
1let { twitterAPIDown } = await import("https://esm.town/v/stevekrouse/twitterAPIDown");
2import process from "node:process";
3import { msHour } from "https://esm.town/v/stevekrouse/msHour";
4import { twitterSearch } from "https://esm.town/v/stevekrouse/twitterSearch";
5
6// let's poll the elevated v2 twitter api
7// until it's down, and store the state in
8// @stevekrouse.twitterAPIDown ({ down: boolean, reason: string})
9export async function checkIfTwitterAPIIsDown() {
10 try {
11 // query for something we know will return results
16 });
17 if (results.length) {
18 // if we get results, the API is still up
19 twitterAPIDown = {
20 down: false,
21 reason: `search returned ${results.length} results at ${new Date()}`,
22 };
23 } else {
24 // no results = API down
25 twitterAPIDown = {
26 down: true,
27 reason: `search returned ${results.length} results at ${new Date()}`,
29 }
30 } catch (e) {
31 // if there's an error, the API is also likely down
32 twitterAPIDown = {
33 down: false,
34 reason: `search errored ${e.message} at ${new Date()}`,

myApimain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

runValAPIEx2 file matches

@charmaine•Updated 14 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)