Readme

Example Hono-Zod-OpenAPI app with a Fiberplane API explorer.

For an example with regular-old Hono, see: https://www.val.town/v/fiberplane/fiberplaneHonoStarter

  1. Import @fiberplane/hono
import { createFiberplane } from "https://esm.sh/@fiberplane/hono@0.4.3-valtown.1";
  1. Expose your OpenAPI spec
app.doc("/doc", { openapi: "3.0.0", info: { title: "User Management API", version: "v1.0.0", }, });
  1. Mount the api explorer
import { createFiberplane } from "https://esm.sh/@fiberplane/hono@0.4.3-valtown.1"; import { OpenAPIHono } from "https://esm.sh/@hono/zod-openapi@0.18.4"; const app = new OpenAPIHono(); // ... Define your api routes here! app.use( "/*", createFiberplane({ openapi: { url: "/doc" }, }), ); export default app.fetch;
  1. Visit your Val's root route to play with the API explorer!

How it Works

createFiberplane mounts a UI at the root route (/), which can be used to explore the api's routes and make requests. Think of it like an embedded, lightweight postman.

Code
HTTP
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!