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=982&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 11482 results for "api"(1623ms)

buddhaRandomQuotemain.tsx1 match

@noaoh•Updated 1 year ago
2
3export const buddhaRandomQuote = (async () => {
4 const resp = await fetch("https://buddha-api.com/api/random");
5 const j = await resp.json();
6 const { text, byName } = j;

annoymain.tsx4 matches

@ajax•Updated 1 year ago
5export async function annoy() {
6 const resume = resume2;
7 // const boo = await import("https://esm.sh/@atproto/api");
8 const { default: BskyAgent } = await import("npm:@atproto/api");
9 console.log(BskyAgent);
10 const agent = new BskyAgent.BskyAgent({ service: "https://bsky.social" });
50 `;
51 console.log({ prompt });
52 const response = await fetch("https://api.openai.com/v1/completions", {
53 method: "POST",
54 headers: {
55 "Content-Type": "application/json",
56 "Authorization": "Bearer " + process.env.OPENAI_API_KEY, // Replace with your OpenAI API Key
57 },
58 body: JSON.stringify({

aliasmain.tsx1 match

@neverstew•Updated 1 year ago
3export function alias<P extends Params>(params: P): Promise<Result<P>> {
4 const username = params.username;
5 let url = `https://api.val.town/v1/alias/${username}`;
6 if ("valName" in params)
7 url = url + `/${params.valName}`;

valToStringmain.tsx1 match

@pomdtr•Updated 1 year ago
6 }
7 const [author, name] = val.split(".");
8 const resp = await fetch(`https://api.val.town/v1/alias/${author}/${name}`);
9 if (resp.status !== 200) {
10 throw new Error(resp.statusText);

chatmain.tsx2 matches

@nimalu•Updated 1 year ago
1import { chatMessages } from "https://esm.town/v/nimalu/chatMessages";
2
3// https://api.val.town/express/@nimalu.chat
4export const chat = (req, res) => {
5 const messages = chatMessages
24 document.getElementById("message-input").value = '';
25 const ul = document.getElementById("inbox");
26 const data = await fetch("https://api.val.town/eval/@nimalu.sendChatMessage('" + message + "','"+ sender + "')")
27 .then(res => res.json())
28 .then(res => res.data)

myApimain.tsx1 match

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

testPostCallmain.tsx1 match

@mehmet•Updated 1 year ago
3export async function testPostCall() {
4 const result = await fetchJSON(
5 "https://api.val.town/express/@stevekrouse.postWebhook1",
6 {
7 method: "POST",

exchangeCurrencymain.tsx1 match

@mgruel•Updated 1 year ago
1import { getExchangeRates } from "https://esm.town/v/mgruel/getExchangeRates";
2
3/** Calls https://www.exchangerate-api.com to retrieve the currency exchange rates
4 * for the provided base currency or "eur" if undefined
5 * @param {string} desired - The desired currency convert to

pageApimain.tsx1 match

@mgruel•Updated 1 year ago
9 };
10};
11export const pageApi = async <T extends any = any>(
12 url: string,
13 { offset = 0, limit = 25 }: {

pipeSampleLLMToolmain.tsx2 matches

@ilyazub•Updated 1 year ago
3
4export const pipeSampleLLMTool = (async () => {
5 const { SerpAPI } = await import("npm:langchain/tools");
6 const { PromptTemplate } = await import("npm:langchain/prompts");
7 const { StringOutputParser } = await import(
8 "npm:langchain/schema/output_parser"
9 );
10 const search = new SerpAPI(process.env.SERPAPI_KEY);
11 const prompt = PromptTemplate.fromTemplate(
12 `Turn the following user input into a search query for a search engine:

gptApiTemplate2 file matches

@charmaine•Updated 2 hours ago

mod-interview-api1 file match

@twschiller•Updated 18 hours ago
apiv1
papimark21