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=914&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 15633 results for "api"(5352ms)

HONCREADME.md2 matches

@cameronpak•Updated 2 months ago
3This is a template for a [HONC](https://honc.dev) project inside ValTown. You should just be able to fork it and get going. It uses:
4
5- Hono for the API
6- Drizzle for the ORM
7- ValTown sqlite for the DB
8- ValTown as the Cloud
9- Fiberplane as the API Explorer
10
11There's a list of example HONC apps for inspiration on GitHub: [here](https://github.com/fiberplane/awesome-honc) and [here](https://github.com/fiberplane/create-honc-app/tree/main/examples)

HONCindex.ts14 matches

@cameronpak•Updated 2 months ago
1import { createFiberplane, createOpenAPISpec } from "./deps/fiberplane.ts";
2import { Hono, HTTPException } from "./deps/hono.ts";
3
4import homePage from "./app/home.tsx";
5import type { AppType } from "./app/types.ts";
6import usersApi from "./app/users.ts";
7import { db } from "./db/client.ts";
8import { migrateDatabase } from "./db/migrate.ts";
22});
23
24/** Mount the user management API at `/api/users` */
25app.route("/api/users", usersApi);
26
27/** Render a Home page (example of using Hono with JSX) */
28app.route("/", homePage);
29
30/** Create a simplified openapi spec that just lists the routes in our app */
31app.get("/openapi.json", async c => {
32 return c.json(
33 createOpenAPISpec(app, {
34 openapi: "3.0.0",
35 info: {
36 title: "Honc D1 App",
42
43/**
44 * Mount the Fiberplane api playground
45 * Visit /fp to view the UI
46 */
48 "/fp/*",
49 createFiberplane({
50 openapi: { url: "/openapi.json" },
51 }),
52);
63/**
64 * Wrap the incoming request, inject the Deno env vars into the Hono app,
65 * and then call the Hono api entrypoint (`app.fetch`)
66 */
67export default async function(req: Request): Promise<Response> {
68 const env = Deno.env.toObject();
69 // NOTE - Adding the entire env object will also expose the following values to your api handlers:
70 //
71 // * `valtown`
72 // * `VAL_TOWN_API_KEY`
73 // * `VALTOWN_API_URL`
74 //
75 // If you don't want those values, remove them from the env object

HONChome.tsx2 matches

@cameronpak•Updated 2 months ago
37 </head>
38 <body class={bodyStyles}>
39 <h1>🪿 Welcome to my HONC API! 🪿</h1>
40 <p>
41 Visit <a href="/fp" class={linkStyles}>/fp</a> to view the Fiberplane API explorer.
42 </p>
43 </body>

HONCfiberplane.ts2 matches

@cameronpak•Updated 2 months ago
1import { createFiberplane, createOpenAPISpec } from "https://esm.sh/@fiberplane/hono@0.4.4";
2
3export { createFiberplane, createOpenAPISpec };

HONChome.tsx2 matches

@fiberplane•Updated 2 months ago
37 </head>
38 <body class={bodyStyles}>
39 <h1>🪿 Welcome to my HONC API! 🪿</h1>
40 <p>
41 Visit <a href="/fp" class={linkStyles}>/fp</a> to view the Fiberplane API explorer.
42 </p>
43 </body>

telegramBotStarterindex.ts1 match

@std•Updated 2 months ago
30 // This is a no-op if nothing's changed
31 if (!isEndpointSet) {
32 await bot.api.setWebhook(req.url, {
33 secret_token: SECRET_TOKEN,
34 });

queryParamsREADME.md1 match

@charmaine•Updated 2 months ago
1# Handling query params in requests
2
3Using the standard [URL#searchParams](https://developer.mozilla.org/en-US/docs/Web/API/URL/searchParams) method, you can grab query parameters out of any val that is operating using the [Web API](https://docs.val.town/api/web).
4
5This val demonstrates how to grab one or more query parameters. It returns the all the query parameters found as a json response.

htmlExampleREADME.md2 matches

@charmaine•Updated 2 months ago
1# Returning HTML from the Val Town Web API
2
3This just lets you use the standard [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) object with our [Web API](https://docs.val.town/api/web) to return an HTML response from this Val.

gracefulVioletTunavt3 matches

@charmaine•Updated 2 months ago
1export default async function createProject(projectName) {
2 const apiToken = Deno.env.get("VAL_TOWN_RW_PROJECTS");
3
4 const response = await fetch("https://api.val.town/v1/projects", {
5 method: "POST",
6 headers: {
7 "Content-Type": "application/json",
8 "Authorization": `Bearer ${apiToken}`,
9 },
10 body: JSON.stringify({

aqiREADME.md1 match

@charmaine•Updated 2 months 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

googleGeminiAPI2 file matches

@michaelwschultz•Updated 5 hours ago

HN-fetch-call2 file matches

@ImGqb•Updated 3 days ago
fetch HackerNews by API
Kapil01
apiv1