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/image-url.jpg%20%22Image%20title%22?q=api&page=1557&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 18021 results for "api"(4177ms)

starWarsmain.tsx2 matches

@danny•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Explore the Star Wars universe, from StarWarsAPI
4export let starWars = fetchJSON(
5 "https://swapi.dev/api/people/1/",
6);

untitled_magentaQuailmain.tsx1 match

@shiann3•Updated 1 year ago
9async function fetchRandomJoke() {
10 const response = await fetch(
11 "https://official-joke-api.appspot.com/random_joke",
12 );
13 return response.json();

getMemain.tsx1 match

@stevekrouse•Updated 1 year ago
2
3export function getMe(): Promise<{ username: string; id: string; profileImageUrl; bio: string }> {
4 return fetchJSON("https://api.val.town/v1/me", {
5 headers: {
6 Authorization: `Bearer ${Deno.env.get("valtown")}`,

refreshAnimalWidgetmain.tsx1 match

@crsven•Updated 1 year ago
15 const birdName = bird.en.replace(" ", "+");
16 newState.data.content_url =
17 `https://api.val.town/express/@crsven.embedBirdSound?args=${birdName},${bird.file},${photoUrl}`;
18 newState.layouts.hello_small.styles.colors.background.color = colorCombo.background;
19 newState.layouts.hello_small.styles.colors.text.color = colorCombo.text;

myApimain.tsx1 match

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

market_kelly_betmain.tsx1 match

@case•Updated 1 year ago
35
36async function getMarket(slug: string) {
37 const res = await fetch(`https://api.manifold.markets/v0/slug/${slug}`);
38
39 if (!res.ok) {

getThreadsActivitymain.tsx1 match

@glommer•Updated 1 year ago
20
21async function getNewThreads() {
22 const resp = await fetch(`https://discord.com/api/guilds/${guild}/threads/active`, {
23 headers: {
24 "Authorization": `Bot ${token}`,

val2imgmain.tsx1 match

@pomdtr•Updated 1 year ago
7 const title = `@${author}/${name}`;
8
9 const resp = await fetch(`https://api.val.town/v1/alias/${author}/${name}`, {
10 headers: {
11 Authorization: `Bearer ${Deno.env.get("valtown")}`,

rpcREADME.md4 matches

@zarutian•Updated 1 year ago
1# RPC
2
3Turn any function into an API! This lets you call a function in Val Town without manually handling a `Request` or `Response` object.
4
5This val can be used as a replacement for the Run API, which implicitly did something similar.
6
7## Create an API from your function:
8
9This is how you can expose a function as an API:
10
111. Create an HTTP handler val

blogmain.tsx2 matches

@pomdtr•Updated 1 year ago
1// title: How does this work ?
2
3import { api } from "https://esm.town/v/pomdtr/api";
4import { article } from "https://esm.town/v/pomdtr/article";
5import { extractMetadata } from "https://esm.town/v/pomdtr/extractMetadata";
62
63async function findMyArticles() {
64 let { data: articles } = await api(`/v1/search/vals?query=${encodeURIComponent("#blog")}`);
65
66 return articles.filter(val => {

Apiify11 file matches

@wolf•Updated 58 mins ago

dailyQuoteAPI

@Souky•Updated 2 days ago
Kapil01
apiv1