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?q=database&page=189&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 7179 results for "database"(1196ms)

stevensDemogetWeather.ts1 match

@jomaโ€ขUpdated 1 week ago
130 }
131
132 console.log(`Weather forecast updated in the database.`);
133 return summary;
134}

stevensDemogetCalendarEvents.ts1 match

@jomaโ€ขUpdated 1 week ago
125 }
126
127 console.log(`Calendar events imported into the database.`);
128 return events;
129 } catch (error) {

stevensDemogenerateFunFacts.ts2 matches

@jomaโ€ขUpdated 1 week 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

stevensDemo.cursorrules2 matches

@jomaโ€ขUpdated 1 week ago
208```
209โ”œโ”€โ”€ backend/
210โ”‚ โ”œโ”€โ”€ database/
211โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Schema definitions
212โ”‚ โ”‚ โ”œโ”€โ”€ queries.ts # DB query functions
270- Handle API calls properly with proper error catching
271
272### Database Patterns
273- Run migrations on startup or comment out for performance
274- Change table names when modifying schemas rather than altering

toolsnotion_endpoints.tsx15 matches

@chadparkerโ€ขUpdated 1 week ago
1import { NotionDatabase } from "./notion-db-interface.tsx";
2
3export default async function(req: Request): Promise<Response> {
7 try {
8 // Check required environment variables
9 const databaseId = Deno.env.get("NOTION_DATABASE_ID");
10
11 if (!databaseId) {
12 return new Response(
13 JSON.stringify({
14 error: "NOTION_DATABASE_ID environment variable is required",
15 setup_instructions: {
16 step1: "Open your Notion database",
17 step2: "Copy the database ID from the URL",
18 step3: "URL format: https://notion.so/[workspace]/[DATABASE_ID]?v=...",
19 step4: "Set NOTION_DATABASE_ID environment variable in Val Town",
20 },
21 }),
27 }
28
29 const notion = new NotionDatabase();
30 let result;
31
32 switch (action) {
33 case "query":
34 // Query all pages from the database
35 const pages = await notion.queryDatabase(databaseId);
36 result = {
37 total_pages: pages.length,
41
42 case "schema":
43 // Get database schema/structure
44 result = await notion.getDatabaseSchema(databaseId);
45 break;
46
69 available_actions: ["query", "schema", "search"],
70 usage: {
71 query: "?action=query - Get all pages from database",
72 schema: "?action=schema - Get database structure",
73 search: "?action=search&q=term - Search for pages",
74 },

toolsnotion-db-interface.tsx33 matches

@chadparkerโ€ขUpdated 1 week ago
1import { Client } from "npm:@notionhq/client@2.2.3";
2
3// Types for Notion database operations
4interface NotionPage {
5 id: string;
9}
10
11interface DatabaseQueryOptions {
12 filter?: any;
13 sorts?: any[];
16}
17
18class NotionDatabase {
19 private client: Client;
20
28
29 /**
30 * Query a database with optional filters and sorting
31 */
32 async queryDatabase(databaseId: string, options: DatabaseQueryOptions = {}): Promise<NotionPage[]> {
33 try {
34 const response = await this.client.databases.query({
35 database_id: databaseId,
36 filter: options.filter,
37 sorts: options.sorts,
42 return response.results as NotionPage[];
43 } catch (error) {
44 console.error('Error querying database:', error);
45 throw error;
46 }
48
49 /**
50 * Get database schema/structure
51 */
52 async getDatabaseSchema(databaseId: string) {
53 try {
54 const response = await this.client.databases.retrieve({
55 database_id: databaseId,
56 });
57 return response.properties;
58 } catch (error) {
59 console.error('Error getting database schema:', error);
60 throw error;
61 }
104 // Check environment variables first
105 const notionToken = Deno.env.get('NOTION_TOKEN');
106 const databaseId = Deno.env.get('NOTION_DATABASE_ID');
107
108 if (action === 'debug') {
112 notion_token_length: notionToken?.length || 0,
113 notion_token_prefix: notionToken?.substring(0, 10) + '...' || 'not set',
114 database_id_exists: !!databaseId,
115 database_id_length: databaseId?.length || 0,
116 database_id_prefix: databaseId?.substring(0, 10) + '...' || 'not set'
117 }
118 }, null, 2), {
129 step3: 'Copy the Internal Integration Token',
130 step4: 'Set NOTION_TOKEN environment variable in Val Town',
131 step5: 'Share your database with the integration'
132 }
133 }), {
137 }
138
139 if (!databaseId) {
140 return new Response(JSON.stringify({
141 error: 'NOTION_DATABASE_ID environment variable is required',
142 setup_instructions: {
143 step1: 'Open your Notion database',
144 step2: 'Copy the database ID from the URL',
145 step3: 'URL format: https://notion.so/[workspace]/[DATABASE_ID]?v=...',
146 step4: 'Set NOTION_DATABASE_ID environment variable in Val Town'
147 }
148 }), {
152 }
153
154 const notion = new NotionDatabase();
155 let result;
156
157 switch (action) {
158 case 'schema':
159 // Get database schema
160 result = await notion.getDatabaseSchema(databaseId);
161 break;
162
163 case 'query':
164 // Query all pages (default action)
165 const pages = await notion.queryDatabase(databaseId);
166 result = {
167 total_pages: pages.length,
191 usage: {
192 debug: '?action=debug - Check environment variables',
193 query: '?action=query - Get all pages from database',
194 schema: '?action=schema - Get database structure',
195 search: '?action=search&q=term - Search for pages'
196 }
214 common_issues: [
215 'Invalid API token - check NOTION_TOKEN',
216 'Database not shared with integration',
217 'Invalid database ID - check NOTION_DATABASE_ID',
218 'Integration lacks proper permissions'
219 ]
227
228// Export for direct usage
229export { NotionDatabase };

Tarunkumarwebsiteindex.ts2 matches

@Tarunkumarโ€ขUpdated 1 week ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { runMigrations } from "./database/migrations.ts";
4import auth from "./routes/auth.ts";
5import destinations from "./routes/destinations.ts";
9const app = new Hono();
10
11// Initialize database on startup
12await runMigrations();
13

Tarunkumarwebsitebookings.ts1 match

@Tarunkumarโ€ขUpdated 1 week ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getCookie } from "https://esm.sh/hono@3.11.7/cookie";
3import { getSessionUser, createFlightBooking, createTrainBooking, createCabBooking, getUserBookings } from "../database/queries.ts";
4import { generateId } from "../../shared/utils.ts";
5import type { FlightBooking, TrainBooking, CabBooking, ApiResponse } from "../../shared/types.ts";

Tarunkumarwebsitedestinations.ts1 match

@Tarunkumarโ€ขUpdated 1 week ago
5const destinations = new Hono();
6
7// Mock destinations data (in a real app, this would come from a database)
8const mockDestinations: Destination[] = [
9 {

Tarunkumarwebsiteauth.ts1 match

@Tarunkumarโ€ขUpdated 1 week ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { setCookie, getCookie } from "https://esm.sh/hono@3.11.7/cookie";
3import { createUser, getUserByEmail, createSession, getSessionUser } from "../database/queries.ts";
4import { generateId, validateEmail } from "../../shared/utils.ts";
5import type { AuthResponse } from "../../shared/types.ts";

bookmarksDatabase

@s3thiโ€ขUpdated 3 months ago

sqLiteDatabase1 file match

@ideofunkโ€ขUpdated 6 months ago