27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />
31Refer to [Twitter's search operators](https://socialdata.gitbook.io/docs/twitter-tweets/retrieve-search-results-by-keyword#endpoint-parameters) to fine-tune your query.
32
33### 4. Test API call
34Set `isProd = false` in the code if you are testing, to ensure there are enough tweets to display. <br>
35Toggle it back to `true` when you're ready to run this cron job in production and actuall send notifications.
60
61### NOTE: Usage Limits
62This val uses the SocialData API for Twitter data:
63
64- **Proxies via Val Town's [SocialDataProxy](https://www.val.town/v/stevekrouse/socialDataProxy)**: Limited to 10 cents per day for [**Val Town Pro users**](https://www.val.town/pricing). This API is *only* for Pro users.
65- **Need more calls?** Sign up for your own [SocialData API token](https://socialdata.tools) and configure the [`socialDataSearch`](https://www.val.town/v/stevekrouse/socialDataSearch) function.
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: {