No matches found in users.
Try switching to another result type using the tabs above.
You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/$%7Burl%7D?q=database&page=1&format=json
For typeahead suggestions, use the /typeahead
endpoint:
https://codesearch.val.run/typeahead?q=database
Returns an array of strings in format "username" or "username/projectName"
Found 7799 results for "database"(2451ms)
No matches found in users.
Try switching to another result type using the tabs above.
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils/index.ts";
3import { runMigrations } from "./database/migrations.ts";
4import recipesApp from "./routes/recipes.ts";
5import parseApp from "./routes/parse.ts";
13});
1415// Initialize database on startup
16let dbInitialized = false;
17async function initializeDatabase() {
18if (!dbInitialized) {
19try {
20await runMigrations();
21dbInitialized = true;
22console.log('Database initialized successfully');
23} catch (error) {
24console.error('Failed to initialize database:', error);
25throw error;
26}
31app.get('/api/health', async (c) => {
32try {
33await initializeDatabase();
34return c.json({ status: 'ok', timestamp: new Date().toISOString() });
35} catch (error) {
40// Test endpoint for debugging delete operations
41app.get('/api/test-delete', async (c) => {
42await initializeDatabase();
43return c.json({ message: 'Delete test endpoint - check logs for database operations' });
44});
4553app.get("/shared/*", c => serveFile(c.req.path, import.meta.url));
5455// Serve main HTML page with database initialization
56app.get("/", async (c) => {
57try {
58await initializeDatabase();
59let html = await readFile("/frontend/index.html", import.meta.url);
60
25## Technical Implementation
2627- **Database**:[Val Town SQLite](https://docs.val.town/std/sqlite/) for storing users, sessions, and magic link tokens
28- **Frontend**: React with Tailwind CSS
29- **Backend**: Hono.js for API routes and middleware