bragreelshowcaseHTML.tsx18 matches
160};
161162// Endpoint to get all pages from a specified database
163app.get("/:id", async (c) => {
164try {
165const databaseId = c.req.param("id");
166167if (!databaseId) {
168return c.html(`
169<html>
170<body>
171<h1>Error</h1>
172<p>Missing required parameter: database ID</p>
173</body>
174</html>
176}
177178// Query the database without any filters to get all pages
179const response = await notion.databases.query({
180database_id: databaseId,
181// No filter - return all pages
182});
197return c.html(html);
198} catch (error) {
199console.error("Error querying database:", error);
200return c.html(`
201<html>
202<body>
203<h1>Error</h1>
204<p>Failed to query database: ${error.message}</p>
205</body>
206</html>
212app.get("/:id/filtered", async (c) => {
213try {
214const databaseId = c.req.param("id");
215const statusValue = c.req.query("status") || "Embed ready";
216217if (!databaseId) {
218return c.html(`
219<html>
220<body>
221<h1>Error</h1>
222<p>Missing required parameter: database ID</p>
223</body>
224</html>
226}
227228// Query the database with a filter for the specified status
229// Using select type for the Status property
230const response = await notion.databases.query({
231database_id: databaseId,
232filter: {
233property: "Status",
253return c.html(html);
254} catch (error) {
255console.error("Error querying database:", error);
256return c.html(`
257<html>
258<body>
259<h1>Error</h1>
260<p>Failed to query database: ${error.message}</p>
261</body>
262</html>
271<body>
272<h1>Showcase HTML API</h1>
273<p>Use /showcase-html/:database_id to get all pages from a database as HTML</p>
274</body>
275</html>
229- `NOTION_API_KEY`: Your Notion API integration token
230231You'll need to create an integration in the Notion workspace and grant it access to the relevant pages or databases.
232233## Usage Examples
test-app-25521database.ts1 match
910/**
11* Get all YAML files from the database
12*/
13export async function getAllYamlFiles(): Promise<YamlFile[]> {
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { runMigrations } from "./database/migrations.ts";
3import jobsRoutes from "./routes/jobs.ts";
4import chatRoutes from "./routes/chat.ts";
13});
1415// Run database migrations
16app.use("*", async (c, next) => {
17try {
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { createChatMessage, getChatMessages, ChatMessage } from "../database/queries.ts";
34const chat = new Hono();
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { createJob, getJobs, getJobById, searchJobs, Job } from "../database/queries.ts";
34const jobs = new Hono();
appmigrations.ts1 match
32`);
3334console.log("Database migrations completed");
35}
1516- `/backend`: Server-side code (Hono.js API)
17- `/database`: SQLite database setup and queries
18- `/routes`: API endpoints
19- `/frontend`: Client-side code (React)
a_new_websiteREADME.md1 match
9- The **client-side entrypoint** is `/frontend/index.html`, which in turn imports `/frontend/index.tsx`, which in turn imports the React app from `/frontend/components/App.tsx`.
1011[React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a fuller featured example project, with a SQLite database table, queries, client-side CSS and a favicon, and some shared code that runs on both client and server.
sqliteExplorerAppREADME.md1 match
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable