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=912&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"(5492ms)

fiberplaneHonoZodStarterdelete-user.ts1 match

@charmaine•Updated 2 months ago
1import { createRoute } from "https://esm.sh/@hono/zod-openapi@0.18.4";
2import { ErrorSchema, UserIdPathParamSchema } from "../schema.ts";
3

fiberplaneHonoZodStartercreate-user.ts1 match

@charmaine•Updated 2 months ago
1import { createRoute } from "https://esm.sh/@hono/zod-openapi@0.18.4";
2import { ErrorSchema, NewUserSchema, UserIdPathParamSchema, UserSchema } from "../schema.ts";
3

fiberplaneHonoZodStarterapi.ts7 matches

@charmaine•Updated 2 months ago
1import { OpenAPIHono } from "https://esm.sh/@hono/zod-openapi@0.18.4";
2import { createRoute } from "https://esm.sh/@hono/zod-openapi@0.18.4";
3import { z } from "https://esm.sh/@hono/zod-openapi@0.18.4";
4import { HTTPException } from "https://esm.sh/hono@4.7.0/http-exception";
5import { ErrorSchema } from "../schema.ts";
6import type { AppType } from "../types.ts";
7
8export const superProtectedApi = new OpenAPIHono<AppType>();
9
10// Define a mock route that is protected with bearer auth
34
35// Mock middleware that just returns 401 if there's no authorization header for the request
36superProtectedApi.use(async (c, next) => {
37 if (!c.req.header("authorization")) {
38 return c.json({ error: "Unauthorized" }, 401);
41});
42
43superProtectedApi.openapi(superSecretSecretsRoute, c => {
44 return c.json({ secrets: ["cold harbor", "other secret idk"] }, 200);
45});
46
47superProtectedApi.openAPIRegistry.registerComponent("securitySchemes", "Bearer", {
48 type: "http",
49 scheme: "bearer",

HONCtypes.ts2 matches

@charmaine•Updated 2 months ago
7 * Optimisitically types the values we expect in our environment and context:
8 *
9 * - `Bindings` determines env vars, accessed via `c.env.NAME_OF_VAR` in api handlers
10 * - `Variables` determines context vars, accessed via `c.get("NAME_OF_VAR")` in api handlers
11 */
12export type AppType = {

HONCREADME.md2 matches

@charmaine•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

@charmaine•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

@charmaine•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

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

grandCoralGrousemain.tsx1 match

@ajax•Updated 2 months ago
61 const frogAdjectives = [
62 "Hopping", "Croaking", "Lily-pad", "Amphibious", "Green",
63 "Swampy", "Marsh", "Pond", "Leaping"
64 ];
65

movieFrogNamermain.tsx1 match

@ajax•Updated 2 months ago
60 const frogAdjectives = [
61 "Hopping", "Croaking", "Lily-pad", "Amphibious", "Green",
62 "Swampy", "Ribbon-tongued", "Marsh", "Pond", "Leaping"
63 ];
64

googleGeminiAPI2 file matches

@michaelwschultz•Updated 5 hours ago

HN-fetch-call2 file matches

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