13
14 However, you should know that SQLite has much more limited
15 support for altering existing tables as compared to other databases.
16 Often it's easier to create new tables with the schema you want, and then
17 copy the data over. */
2import { readFile, servePublicFile } from "https://esm.town/v/stevekrouse/utils@187-main/serve-public/index.ts";
3import { Hono } from "npm:hono";
4import { getMessages, insertMessage } from "./database/queries.ts";
5
6const app = new Hono();
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/App.tsx`.
10
11[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.
98}
99
100// Initialize database for the entire project
101async function initializeDatabase() {
102 console.log("Initializing database...");
103 const SCHEMA_VERSION = 1;
104
112 )
113 `);
114 console.log("Database initialized successfully");
115
116 return { sqlite, SCHEMA_VERSION };
117 } catch (error) {
118 console.error("Database initialization error:", error);
119 throw error;
120 }
249
250 try {
251 // Initialize database
252 const { sqlite, SCHEMA_VERSION } = await initializeDatabase();
253
254 // Update user record if logged in
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`.
10
11[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.
268 * SQLite schema initialization
269 */
270async function initializeDatabase() {
271 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
272 const SCHEMA_VERSION = 1;
338 console.log(`Path: ${path}`);
339
340 // Initialize database
341 const { sqlite, SCHEMA_VERSION, tablePrefix } = await initializeDatabase();
342
343 // Update user record if logged in
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {
47- Server-side rendering for fast initial page loads
48- LastLogin for secure Google authentication
49- SQLite database for persistent storage
50- Tailwind-inspired CSS for clean, modern styling
51- Responsive design that works on all device sizes
1// Database access functions for IdeaScale
2import { DB_KEY, Idea, IdeasResponse, Tag } from "./config";
3
4// Initialize database schema
5export async function initDatabase(sqlite) {
6 await sqlite.execute(`
7 CREATE TABLE IF NOT EXISTS ${DB_KEY}_ideas (
7 parentLinkText: "← char.build",
8
9 // Database config
10 schemaVersion: 1,
11 dbKeyPrefix: "ideascale",