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=948&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 11992 results for "api"(902ms)

discord_note_to_selfmain.tsx2 matches

@wittjosiah•Updated 1 year ago
4 if (!dmId) {
5 console.log("Fetching dmId...", { userId });
6 const channelResponse = await fetch("https://discord.com/api/users/@me/channels", {
7 method: "POST",
8 headers: {
23 console.log("sending", body);
24
25 const dmResponse = await fetch(`https://discord.com/api/channels/${dmId}/messages`, {
26 method: "POST",
27 headers: {

resilientFetchmain.tsx2 matches

@easrng•Updated 1 year ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2async function proxiedFetch(req: Request): Promise<Response> {
3 let query = new URLSearchParams({
6 const headers = new Headers(req.headers);
7 headers.set("X-Valtown-Authorization", `Bearer ${Deno.env.get("valtown")}`);
8 return fetch(`${API_URL}/v1/fetch?${query}`, {
9 ...req,
10 headers,

aqiREADME.md1 match

@andreterron•Updated 1 year ago
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12

instructorExamplemain.tsx1 match

@inkpotmonkey•Updated 1 year ago
4
5const openAISecrets = {
6 apiKey: getApiKey(),
7 organization: getOrganisationKey(),
8};

instructorExampleREADME.md1 match

@inkpotmonkey•Updated 1 year ago
1Example copied https://instructor-ai.github.io/instructor-js/#usage into val.town
2
3You will need to fork this and properly set the apiKey and organisation for it to work.

aqiREADME.md1 match

@djf•Updated 1 year ago
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12

buttonmain.tsx1 match

@easrng•Updated 1 year ago
27 try {
28 const r = await fetch(
29 "https://fonts.googleapis.com/css2?family="
30 + encodeURIComponent("IBM Plex Sans:wght@600")
31 + "&text="

upgradeExpressREADME.md2 matches

@easrng•Updated 1 year ago
1# `upgradeExpress`
2Upgrade Express vals to the Web API without breaking existing consumers
3
4## How it works
5`upgradeExpress` wraps a Web handler into a function that works as normal when called by the Web API, and redirects to the Web API when called by the Express API.
6
7## Example

usermain.tsx2 matches

@easrng•Updated 1 year ago
1import { API_URL } from "https://esm.town/v/std/API_URL?v=5";
2
3export const user = async ({ token, id }: {
10 profileImageUrl: string;
11}> =>
12 await (await fetch(`${API_URL}/v1/users/${id}`, {
13 headers: token
14 ? {

aliasmain.tsx2 matches

@easrng•Updated 1 year ago
1import { API_URL } from "https://esm.town/v/std/API_URL?v=5";
2
3export async function alias<P extends Params>(params: P): Promise<Result<P>> {
4 const username = params.username;
5 let url = `${API_URL}/v1/alias/${username}`;
6 if ("valName" in params)
7 url = url + `/${params.valName}`;

social_data_api_project3 file matches

@tsuchi_ya•Updated 2 hours ago

simple-scrabble-api1 file match

@bry•Updated 3 days ago
apiv1
papimark21