Readme

Example Hono app with a Fiberplane API explorer.

For an example with OpenApiHono, see: https://www.val.town/v/fiberplane/fiberplaneHonoOpenApiStarter

  1. Import @fiberplane/hono
import { createFiberplane, createOpenAPISpec } from "https://esm.sh/@fiberplane/hono@0.4.3";
  1. Generate a simplified API spec (if you don't already have one)
app.get("/openapi.json", async (c) => { const spec = createOpenAPISpec(app, { info: { title: "My Hono API", version: "1.0.0" }, }); return c.json(spec); });
  1. Mount the api explorer

This will mount it at the root /*, but you can mount it to another route, like /fp/* if you are using / for your main app. We recommend / if your Hono app is an API without a frontend.

app.use( "/*", createFiberplane({ openapi: { url: "/openapi.json" }, }), );
  1. Visit your Val's root route to play with the API explorer!

How it Works

createFiberplane mounts Fiberplane on your app at the specified path, which can be used to explore the api's routes and make requests. Think of it like an embedded, lightweigh postman.

If you don't have an API spec at the ready, then the createOpenAPISpec utility helps create a simple OpenAPI spec from all routes in the application. (Note that this simple spec does not include information on expected query parameters, headers, or payloads!)

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!
stevekrouse-fiberplanehonostarter.web.val.run
Updated: February 27, 2025