Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/image-url.jpg%20%22Optional%20title%22?q=database&page=351&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 4348 results for "database"(1195ms)

reactRouter7Examplemigrations.ts3 matches

@tmcw•Updated 1 month ago
6
7/**
8 * Initialize the database schema
9 */
10export async function initializeDatabase() {
11 // Create topics table
12 await sqlite.execute(`
44
45/**
46 * Seed the database with initial data for demonstration
47 */
48async function seedInitialData() {

reactRouter7ExampleHome.loader.ts1 match

@tmcw•Updated 1 month ago
1import { LoaderFunctionArgs } from "https://esm.sh/react-router@7.5.0?deps=react@18.2.0,react-dom@18.2.0";
2import { getAllTopics } from "../backend/database/queries.ts";
3
4export async function loader() {
vtProjectSearch

vtProjectSearchapi.tsx3 matches

@maxm•Updated 1 month ago
77 const needFullDocsData = searchTerm && (resultType === "docs" || format.toLowerCase() === "json");
78
79 // Run database search in parallel with appropriate docs search
80 const [searchResponse, docsResult] = await Promise.all([
81 // Database search for files, projects, users
82 searchTerm
83 ? searchFileContentWithContext(searchTerm, 2, page, pageSize, resultType !== "docs" ? resultType : undefined) // Show 2 lines of context
120 };
121
122 // Only get database stats when needed (no query or empty results)
123 const totalResults = combinedResponse.totalFileResults +
124 combinedResponse.totalProjectResults +

reactRouter7ExampleTopics.action.ts1 match

@stevekrouse•Updated 1 month ago
1import { ActionFunctionArgs, redirect } from "https://esm.sh/react-router@7.5.0?deps=react@18.2.0,react-dom@18.2.0";
2import { createTopic } from "../backend/database/queries.ts";
3
4export async function action({ request }: ActionFunctionArgs) {

reactRouter7ExampleTopic.action.ts1 match

@stevekrouse•Updated 1 month ago
1import { ActionFunctionArgs } from "https://esm.sh/react-router@7.5.0?deps=react@18.2.0,react-dom@18.2.0";
2import { createMessage } from "../backend/database/queries.ts";
3
4export async function action({ request }: ActionFunctionArgs) {

Support_applicationmain.tsx1 match

@beekay•Updated 1 month ago
245 const { pathname } = new URL(request.url);
246
247 // Initialize database
248 await sqlite.execute(`
249 CREATE TABLE IF NOT EXISTS ${KEY}_users (

visionaryCoffeeMarsupialREADME.md1 match

@geoffreylitt•Updated 1 month ago
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

hello-worldindex.http.tsx2 matches

@maxm•Updated 1 month ago
9const app = new Hono();
10
11// Initialize database before handling any requests
12app.use('*', async (c, next) => {
13 await db.initializeDatabase();
14 await db.cleanupExpiredData();
15 await next();

hello-worlddb.ts3 matches

@maxm•Updated 1 month ago
1import { sqlite } from "https://esm.town/v/std/sqlite";
2
3// Database initialization
4export async function initializeDatabase() {
5 try {
6 // Check schemas of existing tables
39 `);
40 } catch (error) {
41 console.error("Database initialization error:", error);
42 }
43}

stevensgenerateFunFacts.ts2 matches

@geoffreylitt•Updated 1 month ago
8
9/**
10 * Retrieves previously generated fun facts from the memories database
11 * @returns Array of previous fun facts
12 */
47
48/**
49 * Inserts a fun fact into the memories database
50 * @param date Date for the fun fact in ISO format
51 * @param factText The fun fact text

bookmarksDatabase

@s3thi•Updated 2 months ago

sqLiteDatabase1 file match

@ideofunk•Updated 5 months ago