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=244&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 2825 results for "database"(431ms)

SecureSend

SecureSendmain.tsx2 matches

@maxm•Updated 2 weeks ago
4const table_prefix = "efs";
5
6// Initialize database schema
7async function initDB() {
8 await sqlite.batch([
763// Main handler
764export default async function(req: Request): Promise<Response> {
765 // Initialize the database
766 await initDB();
767

onboarding_drafttutorial.ts5 matches

@charmaine•Updated 2 weeks ago
101 instructions: `
102 <p><b>1.</b> Create <code>sqliteStorage.ts</code> with this code:</p>
103 <p>This creates a SQLite database to store your todos permanently!</p>
104 `,
105 code: `import { sqlite } from "https://esm.town/v/std/sqlite";
113
114await sqlite.execute(TABLE_SCHEMA);
115console.log("Database table 'todos' checked/created.");
116
117// Type definition for todo items from database
118interface Todo {
119 id: number;
164 title: "Step 4b: Update Web App",
165 instructions: `
166 <p><b>Task:</b> Now let's update <code>todo.ts</code> to use the database!</p>
167 <p>Replace the <b>entire content</b> of <code>todo.ts</code> with this code:</p>
168 `,
280 <ul>
281 <li>Web App: <code>todo.ts</code></li>
282 <li>Database: <code>sqliteStorage.ts</code></li>
283 <li>Email: <code>emailReminder.ts</code></li>
284 </ul>

hn_notifierqueries.ts5 matches

@nbbaier•Updated 2 weeks ago
1import { tableName } from "https://esm.town/v/nbbaier/hn_notifier/backend/database/migrations.ts";
2import type { DBItem } from "https://esm.town/v/nbbaier/hn_notifier/shared/types.ts";
3import sqliteRowsToObject from "https://esm.town/v/nbbaier/sqliteRowsToObject?v=6";
5
6/**
7 * Follows a Hacker News item by inserting it into the database
8 * @param {DBItem} item - The item to follow containing id and comments
9 * @returns {Promise<DBItem[]>} The inserted item
19
20/**
21 * Unfollows a Hacker News item by deleting it from the database
22 * @param {number} id - The ID of the item to unfollow
23 * @returns {Promise<void>}
31
32/**
33 * Retrieves a single item from the database by ID
34 * @param {number} id - The ID of the item to retrieve
35 * @returns {Promise<DBItem[]>} The matching item(s)
44
45/**
46 * Retrieves all items from the database
47 * @returns {Promise<DBItem[]>} Array of all items
48 */

hn_notifierapi.ts1 match

@nbbaier•Updated 2 weeks ago
1import { HTTPException } from "https://esm.sh/hono@4.7.4/http-exception";
2import * as db from "https://esm.town/v/nbbaier/hn_notifier/backend/database/queries.ts";
3import {
4 createDBItem,

hn_notifierindex.ts1 match

@nbbaier•Updated 2 weeks ago
1import api from "https://esm.town/v/nbbaier/hn_notifier/backend/api.ts";
2import { createTables } from "https://esm.town/v/nbbaier/hn_notifier/backend/database/migrations.ts";
3import {
4 readFile,

stevensgetCalendarEvents.ts1 match

@geoffreylitt•Updated 2 weeks ago
125 }
126
127 console.log(`Calendar events imported into the database.`);
128 return events;
129 } catch (error) {

FC-Alt-Client-RedirectREADME.md1 match

@artlu•Updated 2 weeks ago
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.

vtProjectSearch2db.ts3 matches

@charmaine•Updated 2 weeks ago
172
173/**
174 * Get database statistics for the homepage
175 */
176export async function getSearchStats(): Promise<{
837 const offset = (page - 1) * pageSize;
838
839 // Start all database queries in parallel
840 // 1. Launch count queries
841 const countsPromise = Promise.all([
924 );
925
926 // Wait for all database operations to complete in parallel
927 const [
928 [totalFileResults, totalProjectResults, totalUserResults],

vtProjectSearch2components.tsx2 matches

@charmaine•Updated 2 weeks ago
1211 <a href="?q=fetch" className="example-link">fetch</a>
1212 <a href="?q=api" className="example-link">api</a>
1213 <a href="?q=database" className="example-link">database</a>
1214 <a href="?q=image" className="example-link">image</a>
1215 <a href="?q=function" className="example-link">function</a>
1356 <a href="?q=fetch" className="example-link">fetch</a>
1357 <a href="?q=api" className="example-link">api</a>
1358 <a href="?q=database" className="example-link">database</a>
1359 <a href="?q=image" className="example-link">image</a>
1360 <a href="?q=function" className="example-link">function</a>

vtProjectSearch2api.tsx3 matches

@charmaine•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 +