595 <link rel="manifest" href="/manifest.json">
596 <link rel="apple-touch-icon" href="/icon-192x192.png">
597 <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
598 <style>${css}</style>
599 </head>
11 try {
12 const response = await fetch(
13 `https://api.open-meteo.com/v1/forecast?latitude=${location.latitude}&longitude=${location.longitude}¤t_weather=true&hourly=temperature_2m,weathercode&daily=weathercode,temperature_2m_max,temperature_2m_min&timezone=auto`
14 );
15 const data = await response.json();
10 // Attempt multiple copy methods
11 try {
12 // Method 1: Modern Clipboard API
13 if (navigator.clipboard && window.isSecureContext) {
14 navigator.clipboard.writeText(text).then(() => {
154 if (url.pathname === "/contributions") {
155 const username = url.searchParams.get("username") || "Joshuakibwage";
156 const GITHUB_API_URL = `https://api.github.com/users/${username}/events`;
157
158 try {
159 const response = await fetch(GITHUB_API_URL);
160 const events: GitHubEvent[] = await response.json();
161
1Example Hono app with a Fiberplane API explorer.
2
3> For an example with `OpenApiHono`, see: https://www.val.town/x/fiberplane/fiberplaneHonoZodStarter
4
51. Import `@fiberplane/hono`
7 import {
8 createFiberplane,
9 createOpenAPISpec
10 } from "https://esm.sh/@fiberplane/hono@0.4.4";
11 ```
12
132. Generate a simplified API spec (if you don't already have one)
14 ```ts
15 app.get("/openapi.json", async (c) => {
16 const spec = createOpenAPISpec(app, {
17 info: { title: "My Hono API", version: "1.0.0" },
18 });
19 return c.json(spec);
21 ```
22
233. Mount the api explorer
24
25This will mount it at the root `/*`, but you can mount it to another route, like `/fp/*` if you
26are using `/` for your main app. We recommend `/` if your Hono app is an API without a frontend.
27
28 ```ts
30 "/*",
31 createFiberplane({
32 openapi: { url: "/openapi.json" },
33 }),
34 );
35 ```
36
374. Visit your Val's root route to play with the API explorer!
38
39## How it Works
40
41`createFiberplane` mounts Fiberplane on your app at the specified path, which can be used to explore the api's routes and make requests.
42Think of it like an embedded, lightweigh postman.
43
44
45If 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.
46(_Note that this simple spec does not include information on expected query parameters, headers, or payloads!_)
47
67 async function fetchJobs() {
68 try {
69 // In a real implementation, you'd use web scraping or an API
70 // This is a mock implementation
71 const mockJobs = [
225export default async function server(request: Request): Promise<Response> {
226 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
227 const KEY = "lovingCoralTapir";
228 const SCHEMA_VERSION = 5;
229
1import { API_URL } from "https://esm.town/v/std/API_URL";
2import { LibsqlError, type TransactionMode } from "npm:@libsql/client";
3import { z } from "npm:zod";
35
36async function execute(statement: InStatement): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
49
50async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
51 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
52 method: "POST",
53 headers: {
18fixi.js is an experimental, minimalist implementation of generalized hypermedia controls
19
20The fixi api consists of six HTML attributes, nine events & two properties
21
22Here is an example:
36 setLoading(true);
37 const response = await fetch(
38 `https://api.open-meteo.com/v1/forecast?latitude=${location.latitude}&longitude=${location.longitude}¤t_weather=true&hourly=temperature_2m,relative_humidity_2m,wind_speed_10m&daily=temperature_2m_max,temperature_2m_min,sunrise,sunset&timezone=auto`
39 );
40 const data = await response.json();