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=836&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 10974 results for "api"(1723ms)

leaderboardmain.tsx1 match

@sqlite•Updated 1 year ago
10 const table = stripAnsi(renderTable(zip(res)));
11
12 const resp = await fetch("https://sourcecodeshots.com/api/image", {
13 method: "POST",
14 headers: {

httpmain.tsx1 match

@rlimit•Updated 1 year ago
6
7/**
8 * API Client for interfacing with the RateLimit API. Uses free tier rlimit.com credentials.
9 */
10export class RateLimit {

slackBotExamplemain.tsx1 match

@maxm•Updated 1 year ago
16 // like the sender and the message text
17 const result = await fetchJSON(
18 "https://slack.com/api/chat.postMessage",
19 {
20 headers: {

telegramWebhookExamplemain.tsx1 match

@maxm•Updated 1 year ago
4 // Verify this webhook came from our bot
5 if (
6 req.headers.get("x-telegram-bot-api-secret-token")
7 !== Deno.env.get("telegramWebhookSecret")
8 ) {

nasaAPODmain.tsx1 match

@henrii•Updated 1 year ago
2
3// Returns NASA's Astronomy Picture of the Day (APOD)
4export const nasaAPOD = await fetchJSON("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY");
5console.log(nasaAPOD.url);
6

gptTagmain.tsx1 match

@vladimyr•Updated 1 year ago
3async function getOpenAI() {
4 // if you don't have a key, use our std library version
5 if (Deno.env.get("OPENAI_API_KEY") === undefined) {
6 const { OpenAI } = await import("https://esm.town/v/std/openai");
7 return new OpenAI();

chatmain.tsx1 match

@andreterron•Updated 1 year ago
3async function getOpenAI() {
4 // if you don't have a key, use our std library version
5 if (Deno.env.get("OPENAI_API_KEY") === undefined) {
6 const { OpenAI } = await import("https://esm.town/v/std/openai");
7 return new OpenAI();

fetchNewPublicGitHubReposmain.tsx3 matches

@stevekrouse•Updated 1 year ago
7 const order = "desc";
8
9 const url = `https://api.github.com/search/repositories?q=${encodeURIComponent(query)}&sort=${sort}&order=${order}`;
10
11 const response = await fetch(url, {
12 headers: {
13 "Accept": "application/vnd.github.v3+json",
14 "User-Agent": "Deno-GitHub-Repo-Fetcher", // GitHub API requires a user-agent header
15 },
16 });
17
18 if (!response.ok) {
19 throw new Error(`GitHub API responded with status: ${response.status}`);
20 }
21

http_request_examplemain.tsx2 matches

@pomdtr•Updated 1 year ago
4 */
5
6// To make a request to a server, you use the `fetch` API.
7let resp = await fetch("https://example.com");
8
32 headers: {
33 "Content-Type": "application/json",
34 "X-API-Key": "foobar",
35 },
36 body,

setmain.tsx2 matches

@pomdtr•Updated 1 year ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import process from "node:process";
5export async function set(key: string, value: any) {
6 let resp = await fetch(
7 `${API_URL}/v1/vals`,
8 {
9 method: "PUT",

daily-advice-app1 file match

@dcm31•Updated 2 days ago
Random advice app using Advice Slip API

gptApiTemplate1 file match

@charmaine•Updated 3 days ago
apiv1
papimark21