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=831&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"(1785ms)

dependenciesmain.tsx2 matches

@pomdtr•Updated 1 year ago
1import { api } from "https://esm.town/v/pomdtr/api";
2
3type ValRef = {
23export async function searchReferences(val: ValRef) {
24 const esmUrl = `https://esm.town/v/${val.author}/${val.name}`;
25 const { data: vals } = await api(`/v1/search/vals?query=${encodeURIComponent(esmUrl)}`, {
26 authenticated: true,
27 paginate: true,

insecureFetchREADME.md1 match

@stevekrouse•Updated 1 year ago
8import { insecureFetch } from "https://esm.town/v/stevekrouse/insecureFetch";
9
10const url = "https://assignment-api.uspto.gov/patent/basicSearch?query=1234567&fields=main&rows=20";
11const data = await insecureFetch(url)
12const text = await data.text();

openaiUploadFilemain.tsx1 match

@stevekrouse•Updated 1 year ago
16 formData.append("purpose", purpose);
17 formData.append("file", file, "data.json");
18 let result = await fetch("https://api.openai.com/v1/files", {
19 method: "POST",
20 headers: {

val_town_by_example_parsemain.tsx3 matches

@pomdtr•Updated 1 year ago
1import { api } from "https://esm.town/v/pomdtr/api";
2
3export type Example = {
87
88export async function parseExample(author: string, name: string): Promise<Example> {
89 let { code } = await api<{ code: string }>(`/v1/alias/${author}/${name}`);
90 // Substitute $std/ with the full import url
91 code = code.replaceAll("$std/", "https://deno.land/std@0.207.0/");
141 for (const slug of vals) {
142 const [author, name] = slug.split("/");
143 const { code } = await api(`/v1/alias/${author}/${name}`);
144 example.vals.push({
145 author,

apimain.tsx4 matches

@pomdtr•Updated 1 year ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2
3export async function api<T = any>(
4 path: string,
5 options?: RequestInit & {
11 if (options?.paginate) {
12 const data = [];
13 let url = new URL(`${API_URL}${path}`);
14 url.searchParams.set("limit", "100");
15
32 return { data } as T;
33 }
34 const resp = await fetch(`${API_URL}${path}`, {
35 ...options,
36 headers: {

apimain.tsx4 matches

@zeroftdev•Updated 1 year ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2
3export async function api<T = any>(
4 path: string,
5 options?: RequestInit & {
11 if (options?.paginate) {
12 const data = [];
13 let url = new URL(`${API_URL}${path}`);
14 url.searchParams.set("limit", "100");
15
32 return { data } as T;
33 }
34 const resp = await fetch(`https://api.val.town${path}`, {
35 ...options,
36 headers: {

CS1200SystemsDevmain.tsx1 match

@stephencooley123•Updated 1 year ago
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();

aquamarineFlamingomain.tsx1 match

@tual•Updated 1 year ago
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();

cyanVolemain.tsx1 match

@rohannagpure45•Updated 1 year ago
3async function fetchRandomJoke() {
4 const response = await fetch(
5 "https://official-joke-api.appspot.com/random_joke",
6 );
7 return response.json();

oliveButterflymain.tsx1 match

@yawnxyz•Updated 1 year ago
16 formData.append("purpose", purpose);
17 formData.append("file", file, "data.json");
18 let result = await fetch("https://api.openai.com/v1/files", {
19 method: "POST",
20 headers: {

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