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/?q=database&page=248&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 2820 results for "database"(318ms)

reactRouter7ExampleHome.loader.ts1 match

@tmcw•Updated 2 weeks 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 2 weeks 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 2 weeks 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 2 weeks 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) {

hello-worldindex.http.tsx2 matches

@maxm•Updated 2 weeks 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 2 weeks 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 2 weeks 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
1import { LoaderFunctionArgs } from "https://esm.sh/react-router@7.5.0?deps=react@18.2.0,react-dom@18.2.0";
2import { getTopicById, getMessageById, getMessagesByTopicId } from "../backend/database/queries.ts";
3
4export async function loader({ params }: LoaderFunctionArgs) {

reactRouter7ExampleTopic.loader.ts1 match

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

reactRouter7ExampleSearch.loader.ts1 match

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