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/$%7Burl%7D?q=api&page=1000&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 12282 results for "api"(1273ms)

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

crates_iomain.tsx3 matches

@vladimyrUpdated 1 year ago
12import { joinURL } from "npm:ufo@1.3.2";
13
14const API_URL = "https://crates.io/api/v1/";
15
16const VersionSchema = transform(
17 object({
18 num: string(),
19 dl_path: string([toCustom(input => (new URL(input, API_URL)).href)]),
20 yanked: boolean(),
21 }),
27
28export async function getCrateInfo(crateName: string, version?: string) {
29 const createURL = joinURL(API_URL, `/crates/${crateName}`);
30 const crateInfo = parse(CrateInfoSchema, await ky.get(createURL).json());
31 const versions = crateInfo.versions.filter(it => !it.yanked);

systemsDevModulemain.tsx1 match

@ethtangUpdated 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();

honoZodSwaggerUimain.tsx16 matches

@stevekrouseUpdated 1 year ago
1/** @jsxImportSource https://esm.sh/hono@3.9.2/jsx **/
2import { swaggerUI } from "npm:@hono/swagger-ui";
3import { z } from "npm:@hono/zod-openapi";
4import { OpenAPIHono } from "npm:@hono/zod-openapi";
5import { createRoute } from "npm:@hono/zod-openapi";
6
7const ParamsSchema = z.object({
9 .string()
10 .min(3)
11 .openapi({
12 param: {
13 name: "id",
20const UserSchema = z
21 .object({
22 id: z.string().openapi({
23 example: "123",
24 }),
25 name: z.string().openapi({
26 example: "John Doe",
27 }),
28 age: z.number().openapi({
29 example: 42,
30 }),
31 })
32 .openapi("User");
33
34const route = createRoute({
50});
51
52const app = new OpenAPIHono();
53
54app.get("/", c =>
58 <ul>
59 <li>
60 <a href="/openapi.json">OpenAPI Spec</a>
61 </li>
62 <li>
64 </li>
65 <li>
66 Example API call:{" "}
67 <a href="/users/123">
68 <code>GET /users/123</code>
73 ));
74
75app.openapi(route, (c) => {
76 const { id } = c.req.valid("param");
77 return c.json({
82});
83
84app.doc("/openapi.json", {
85 openapi: "3.0.0",
86 info: {
87 version: "1.0.0",
88 title: "My API",
89 },
90});
91app.get("/swagger", swaggerUI({ url: "/openapi.json" }));
92
93export default app.fetch;

podnewsmain.tsx2 matches

@vladimyrUpdated 1 year ago
31 podnewsId = await getPodnewsId(podcastInfo.podcastId);
32 }
33 const apiURL = new URL(`/api/podcast-search/lookup-${podnewsId}`, BASE_URL);
34 const data = await ky.get(apiURL).json();
35 if (!Array.isArray(data)) return;
36 const feedUrl = data.at(0)?.feedUrl;

createValREADME.md1 match

@andreterronUpdated 1 year ago
1Migrated from folder: A_Features/_23_12_04_Update_Vals_API/createVal

handleGroupmeMessagemain.tsx2 matches

@tjnoeUpdated 1 year ago
8 const getRandomRhyme = async (word: string) => {
9 const rhymeRes = await fetch(
10 `https://api.datamuse.com/words?rel_rhy=${word}`,
11 );
12 const rhymes = await rhymeRes.json();
20 };
21 const sendGroupmeMessage = async (bot_id: string, text: string) => {
22 const response = await fetch("https://api.groupme.com/v3/bots/post", {
23 method: "POST",
24 headers: {

untitled_blackBeemain.tsx3 matches

@boucherUpdated 1 year ago
1import { runValAPIAuth } from "https://esm.town/v/stevekrouse/runValAPIAuth";
2
3// grab the types off turso's client without importing it
6
7export function turso(keys, handle?) {
8 let val = "@std.tursoAPI";
9 let f = (method) => (...args) =>
10 runValAPIAuth({
11 val,
12 args: [method, args],

untitled_blackBeeREADME.md1 match

@boucherUpdated 1 year ago
35## Architecture
36
37This @std.turso function is the client or SDK to @std.tursoAPI, which acts as a "proxy" to Turso. It handles authentication, creates databases, and forwards on your SQL queries. You can get lower latency (~200ms vs ~800ms), more storage, databases, CLI & API access by having your own Turso account.
5}
6
7const video_url = "https://api.bilibili.com/x/web-interface/dynamic/region?ps=6&rid=1";
8
9export async function get_random_video(cookie) {

social_data_api_project3 file matches

@tsuchi_yaUpdated 2 days ago

simple-scrabble-api1 file match

@bryUpdated 5 days ago
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com