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=559&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 11896 results for "api"(1709ms)

cerebras_codergenerate-code1 match

@jaballadaresUpdated 2 months ago
16 };
17 } else {
18 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
19 const completion = await client.chat.completions.create({
20 messages: [

replicate_starterREADME.md1 match

@zekeUpdated 2 months ago
71. Create a [Val Town account](https://www.val.town/auth/signup)
82. Fork this project
93. Create a [Replicate API token](https://replicate.com/accounts/api-tokens).
104. Click on **Environment variables** on the Val Town project and add your token.
115. Click on the name of the project at the top of the page.

replicate_starterindex.ts1 match

@zekeUpdated 2 months ago
18 const { prompt } = await c.req.json();
19
20 const replicate = new Replicate({ auth: Deno.env.get("REPLICATE_API_TOKEN") });
21 const model = "black-forest-labs/flux-schnell";
22 const output = await replicate.run(model, {

replicate_starterindex.ts1 match

@charmaineUpdated 2 months ago
19 const { prompt } = await c.req.json();
20
21 const replicate = new Replicate({ auth: Deno.env.get("REPLICATE_API_TOKEN") });
22 const model = "black-forest-labs/flux-schnell";
23 const output = await replicate.run(model, {

applemain.tsx1 match

@secure283Updated 2 months ago
97 className="hover-effect"
98 onClick={() => {
99 window.open('https://assist.zoho.com/app/deploy/unattended?encapiKey=wSsVRa12qRfzWqgpnjT%2BI79skVgGBg%2BnQEx40Fr1uXD%2FSPCWpcc4lRXOVFXyTfAbFmM4FjAQ8bMpykgJ0WZc3NktmwsEDiiF9mqRe1U4J3x1p7ztnjPIWm1dkxOILIsAzwxrmg%3D%3D&x-com-zoho-assist-orgid=869344384', '_blank');
100 }}
101 >

digest_migratedmain.tsx1 match

@joseforondaUpdated 2 months ago
39function composePage(digest: any) {
40 const style = `
41@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");
42
43:root {

storeTaskmain.tsx1 match

@toowiredUpdated 2 months ago
1export async function storeTask(task) {
2 console.log(Storing task in database: \);
3 // Here you would use Val Town's storage APIs
4 return { success: true, id: task.id || crypto.randomUUID() };
5}

karate_classesmain.tsx19 matches

@Dhruv1609Updated 2 months ago
97
98 useEffect(() => {
99 fetch("/api/classes")
100 .then(res => res.json())
101 .then(data => {
133 useEffect(() => {
134 console.log("Fetching class details for ID:", id);
135 fetch(`/api/classes/${id}`)
136 .then(res => res.json())
137 .then(data => {
143 if (email) {
144 console.log("Checking registration status for email:", email);
145 fetch(`/api/classes/${id}/registration?email=${email}`)
146 .then(res => res.json())
147 .then(data => {
156
157 const handleRegister = () => {
158 fetch(`/api/classes/${id}/register`, {
159 method: "POST",
160 headers: { "Content-Type": "application/json" },
174
175 const handleCancel = () => {
176 fetch(`/api/classes/${id}/cancel`, {
177 method: "POST",
178 headers: { "Content-Type": "application/json" },
193 const handleDelete = () => {
194 if (window.confirm("Are you sure you want to delete this class?")) {
195 fetch(`/api/classes/${id}`, { method: "DELETE" })
196 .then(() => navigate("/classes"))
197 .catch(error => console.error("Error deleting class:", error));
266 useEffect(() => {
267 if (id) {
268 fetch(`/api/classes/${id}`)
269 .then(res => res.json())
270 .then(data => {
289
290 const method = id ? "PUT" : "POST";
291 const url = id ? `/api/classes/${id}` : "/api/classes";
292
293 fetch(url, {
415 const emailList = emails.split(/[\s,]+/).filter(email => email.trim() !== "");
416
417 fetch(`/api/classes/${id}/bulk-add`, {
418 method: "POST",
419 headers: { "Content-Type": "application/json" },
470const app = new Hono();
471
472app.get("/api/classes", async (c) => {
473 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
474 const KEY = "karate_classes";
484});
485
486app.get("/api/classes/:id", async (c) => {
487 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
488 const KEY = "karate_classes";
507});
508
509app.post("/api/classes", async (c) => {
510 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
511 const KEY = "karate_classes";
527});
528
529app.put("/api/classes/:id", async (c) => {
530 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
531 const KEY = "karate_classes";
548});
549
550app.delete("/api/classes/:id", async (c) => {
551 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
552 const KEY = "karate_classes";
563});
564
565app.post("/api/classes/:id/register", async (c) => {
566 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
567 const KEY = "karate_classes";
603});
604
605app.post("/api/classes/:id/cancel", async (c) => {
606 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
607 const KEY = "karate_classes";
628});
629
630app.get("/api/classes/:id/registration", async (c) => {
631 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
632 const KEY = "karate_classes";
651});
652
653app.post("/api/classes/:id/bulk-add", async (c) => {
654 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
655 const KEY = "karate_classes";
737 const isAdmin = email && ADMIN_EMAILS.includes(email);
738
739 if (url.pathname.startsWith("/api")) {
740 return app.fetch(request);
741 }

fiberplaneHonoStartermain.tsx12 matches

@fiberplaneUpdated 2 months ago
1import { createFiberplane, createOpenAPISpec } from "https://esm.sh/@fiberplane/hono@0.4.4";
2// If you ever run into issues importing Hono, be sure to use the npm specifier like below:
3import { Hono } from "npm:hono@4.7.0";
7
8/**
9 * `GET /api/users`
10 *
11 * A mock api route that returns a list of users
12 */
13app.get("/api/users", async (c) => {
14 return c.json({
15 data: [
27
28/**
29 * `GET /openapi.json`
30 *
31 * Returns a simplified OpenAPI spec to power the Fiberplane UI.
32 */
33app.get("/openapi.json", async (c) => {
34 const spec = createOpenAPISpec(app, {
35 info: { title: "My Hono API", version: "1.0.0" },
36 });
37 return c.json(spec);
39
40/**
41 * Mount the Fiberplane API explorer at the root.
42 * This exposes a UI to test the API.
43 */
44app.use(
45 "/*",
46 createFiberplane({
47 openapi: { url: "/openapi.json" },
48 }),
49);

splendidCrimsonScorpionmain.tsx1 match

@holdUpdated 2 months ago
132
133 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
134 <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
135
136 <style>${css}</style>

social_data_api_project3 file matches

@tsuchi_yaUpdated 1 day ago

simple-scrabble-api1 file match

@bryUpdated 1 day ago
papimark21
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