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/$%7Bsuccess?q=api&page=1023&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 11836 results for "api"(957ms)

incrementAPICountermain.tsx3 matches

@andreterron•Updated 1 year ago
1let { apiCounter } = await import("https://esm.town/v/andreterron/apiCounter");
2
3export let incrementAPICounter = (req, res: express.Response) => {
4 apiCounter += 1;
5 res.send(JSON.stringify({ status: "Success!" }));
6};

searchTweetsmain.tsx1 match

@andreterron•Updated 1 year ago
8 const q = new URLSearchParams({ query, ...params }).toString();
9 const results = await fetchJSON(
10 `https://api.twitter.com/2/tweets/search/recent?${q}`,
11 {
12 headers: {

myApimain.tsx1 match

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

getPoemForTimemain.tsx1 match

@crsven•Updated 1 year ago
3export let getPoemForTime = async (time: string) => {
4 const poemResponse = await fetch(
5 `https://poem.town/api/v1/clock/poem/${time}`
6 );
7 const poemJson = await poemResponse.json();

postToMastodonmain.tsx2 matches

@sebdd•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export function postToMastodon(mastodonApiUrl, mastodonAccessToken, status) {
4 return fetch(
5 `${mastodonApiUrl}/statuses?access_token=${mastodonAccessToken}`,
6 {
7 headers: {

postWebhookTestmain.tsx1 match

@ggarnhart•Updated 1 year ago
2
3export let postWebhookTest = fetchJSON(
4 "https://api.val.town/express/@ggarnhart.citiBikeSpotChecker",
5 {
6 method: "POST",

chatSampleFunctionSinglemain.tsx1 match

@webup•Updated 1 year ago
4export const chatSampleFunctionSingle = (async () => {
5 // Example dummy function hard coded to return the same weather
6 // In production, this could be your backend API or an external API
7 const getCurrentWeather = (location, unit = "fahrenheit") => ({
8 unit,

chatmain.tsx4 matches

@steveb1313•Updated 1 year ago
6 options = {},
7) => {
8 // Initialize OpenAI API stub
9 const { Configuration, OpenAIApi } = await import("https://esm.sh/openai");
10 const configuration = new Configuration({
11 apiKey: process.env.openAIAPI,
12 });
13 const openai = new OpenAIApi(configuration);
14 // Request chat completion
15 const messages = typeof prompt === "string"

captureCalendlyWebhookmain.tsx1 match

@ianvph•Updated 1 year ago
21 };
22 capturePostHogEvent(
23 process.env.phProjectAPIKey,
24 user,
25 eventName,

myApimain.tsx1 match

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

simple-scrabble-api1 file match

@bry•Updated 6 hours ago

social_data_api_project3 file matches

@tsuchi_ya•Updated 13 hours ago
apiv1
papimark21