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=898&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 10707 results for "api"(1586ms)

parserSampleJSONmain.tsx1 match

@webup•Updated 1 year ago
21 const model = await builder();
22 const input = await prompt.format({
23 question: "What is the capital of France?",
24 });
25 const response = await model.call(input);

chatmain.tsx2 matches

@mario•Updated 1 year ago
1import { chatMessages } from "https://esm.town/v/mario/chatMessages";
2
3// https://api.val.town/express/@nimalu.chat
4export const chat = (req, res) => {
5 const messages = chatMessages
27 li.innerHTML = '<span class="font-semibold text-gray-900">' + sender + '</span>: ' + message;
28 ul.appendChild(li)
29 fetch("https://api.val.town/eval/@nimalu.sendChatMessage('" + message + "','"+ sender + "')")
30 }
31
6 res: express.Response,
7) {
8 let response = await fetch("https://api.onepeloton.com/auth/login", {
9 method: "POST",
10 mode: "no-cors",
21 const session = await response.json();
22 let workoutResponse = await fetch(
23 `https://api.onepeloton.com/api/user/${session["user_id"]}/workouts`,
24 {
25 method: "GET",
38 );
39 const airtable = new Airtable({
40 apiKey: process.env.airTablePelo,
41 baseId: process.env.airTableBase,
42 tableName: "Table 1",

fetchCongressTradeReportsmain.tsx1 match

@claytn•Updated 1 year ago
11export async function fetchCongressTradeReports(callback) {
12 const res = await fetchJSON(
13 "https://bff.capitoltrades.com/trades?sortBy=-pubDate"
14 );
15 const trades = res.data;

getTrainsmain.tsx2 matches

@briscoe•Updated 1 year ago
3export const getTrains = (async () => {
4 const skerries = await fetch(
5 "https://irish-rail-rest-api.fly.dev/stations/SKRES/timetable",
6 ).then((res) => res.json());
7 const connolly = await fetch(
8 "https://irish-rail-rest-api.fly.dev/stations/CNLLY/timetable",
9 ).then((res) => res.json());
10 return {
1import { testMutateSemantics } from "https://esm.town/v/stevekrouse/testMutateSemantics";
2
3export const unauthenticatedCanMutateViaObjectSneak = (api) =>
4 testMutateSemantics({
5 stateName: "@stevekrouse.testState",
6 api,
7 expected: (old, next) => next.n2 === next.n,
8 mutator: (now) => `(() => {

myApimain.tsx1 match

@irreal•Updated 1 year ago
1export function myApi(name) {
2 console.email("yay " + name);
3 return "hi :)" + name;

convertCurrencymain.tsx2 matches

@frankdilo•Updated 1 year ago
3export let convertCurrency = async (desired, base = "usd", amount = 1) => {
4 let { rates } = await fetchJSON(
5 `https://open.er-api.com/v6/latest/${base}`,
6 );
7 if (rates && rates[desired.toUpperCase()])
9 else {
10 let { rates } = await fetchJSON(
11 "https://api.coingecko.com/api/v3/exchange_rates",
12 );
13 return amount * rates[desired.toLowerCase()]?.value /

myApimain.tsx1 match

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

myApimain.tsx1 match

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

daily-advice-app1 file match

@dcm31•Updated 1 day ago
Random advice app using Advice Slip API

gptApiTemplate1 file match

@charmaine•Updated 2 days ago
apiv1
papimark21