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=199&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 7183 results for "database"(2184ms)

YESindex.ts13 matches

@Elohimโ€ขUpdated 1 week ago
3import { Hono } from "https://esm.sh/hono@3.11.7";
4import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
5import { runMigrations } from "./database/migrations.ts";
6
7// Import route modules
19});
20
21// Initialize database on startup
22let dbInitialized = false;
23async function initializeDatabase() {
24 if (!dbInitialized) {
25 try {
26 await runMigrations();
27 dbInitialized = true;
28 console.log('Database initialized successfully');
29 } catch (error) {
30 console.error('Database initialization failed:', error);
31 }
32 }
35// Health check endpoint
36app.get('/api/health', async (c) => {
37 await initializeDatabase();
38
39 return c.json({
41 timestamp: new Date().toISOString(),
42 version: '1.0.0',
43 database: dbInitialized ? 'connected' : 'disconnected'
44 });
45});
58// Serve main application
59app.get("/", async (c) => {
60 await initializeDatabase();
61
62 let html = await readFile("/frontend/index.html", import.meta.url);
87// Role-based dashboard routes
88app.get("/student/*", async (c) => {
89 await initializeDatabase();
90 let html = await readFile("/frontend/index.html", import.meta.url);
91
100
101app.get("/teacher/*", async (c) => {
102 await initializeDatabase();
103 let html = await readFile("/frontend/index.html", import.meta.url);
104
113
114app.get("/admin/*", async (c) => {
115 await initializeDatabase();
116 let html = await readFile("/frontend/index.html", import.meta.url);
117
126
127app.get("/parent/*", async (c) => {
128 await initializeDatabase();
129 let html = await readFile("/frontend/index.html", import.meta.url);
130
140// Catch-all route for SPA
141app.get("*", async (c) => {
142 await initializeDatabase();
143 let html = await readFile("/frontend/index.html", import.meta.url);
144

YESparent.ts1 match

@Elohimโ€ขUpdated 1 week ago
10 getUserNotifications,
11 createPayment
12} from "../database/queries.ts";
13import { processSchoolFeePayment, verifySchoolFeePayment } from "../services/mobile-money.ts";
14import type { ApiResponse, ParentDashboardData } from "../../shared/types.ts";

YESadmin.ts1 match

@Elohimโ€ขUpdated 1 week ago
12 getComplaintsByUser,
13 createNotification
14} from "../database/queries.ts";
15import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
16import type { ApiResponse, AdminDashboardData, User, UserRole } from "../../shared/types.ts";

YESteacher.ts2 matches

@Elohimโ€ขUpdated 1 week ago
13 getUserNotifications,
14 createNotification
15} from "../database/queries.ts";
16import type { ApiResponse, TeacherDashboardData } from "../../shared/types.ts";
17
408 }
409
410 // TODO: Implement work hours logging in database
411 // For now, return success
412 const workHours = {

YESstudent.ts1 match

@Elohimโ€ขUpdated 1 week ago
15 createComplaint,
16 getComplaintsByUser
17} from "../database/queries.ts";
18import type { ApiResponse, StudentDashboardData } from "../../shared/types.ts";
19

YESauth.ts1 match

@Elohimโ€ขUpdated 1 week ago
64 }
65
66 // Create or update user in database
67 const user = await createOrUpdateUser(googleUser);
68

YESoauth.ts1 match

@Elohimโ€ขUpdated 1 week ago
2
3import type { User, UserRole } from "../../shared/types.ts";
4import { createUser, getUserByEmail, updateUserLastLogin } from "../database/queries.ts";
5
6const GOOGLE_CLIENT_ID = Deno.env.get('GOOGLE_CLIENT_ID');

YESmigrations.ts3 matches

@Elohimโ€ขUpdated 1 week ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2
3// Database schema migrations for Xplicit E-learning platform
4
5export async function runMigrations() {
6 console.log('Running database migrations...');
7
8 // Users table
313 `);
314
315 console.log('Database migrations completed successfully');
316}
317

YESREADME.md1 match

@Elohimโ€ขUpdated 1 week ago
24โ”œโ”€โ”€ backend/
25โ”‚ โ”œโ”€โ”€ auth/ # Authentication & authorization
26โ”‚ โ”œโ”€โ”€ database/ # Database schemas & queries
27โ”‚ โ”œโ”€โ”€ routes/ # API endpoints by user type
28โ”‚ โ”œโ”€โ”€ services/ # Google Workspace integrations

Xplicit_E-learningindex.ts7 matches

@PiZionโ€ขUpdated 2 weeks ago
4import { getCookie, setCookie, deleteCookie } from "https://esm.sh/hono@3.11.7/cookie";
5import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
6import { runMigrations, seedData } from './database/migrations.ts';
7import { getDashboardStats } from './database/queries.ts';
8import { GoogleOAuthService } from './auth/google-oauth.ts';
9import { GoogleWorkspaceService } from './services/google-workspace.ts';
20});
21
22// Initialize database on startup
23try {
24 await runMigrations();
25 // Comment out seedData for production
26 // await seedData();
27 console.log('Database initialized successfully');
28} catch (error) {
29 console.error('Database initialization failed:', error);
30}
31
81 const role = googleAuth.determineUserRole(googleUser.email);
82
83 // Create or update user in database
84 const user = {
85 id: `user_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
94 };
95
96 // Store user in database (you'd implement this in queries.ts)
97 // await createOrUpdateUser(user);
98

bookmarksDatabase

@s3thiโ€ขUpdated 3 months ago

sqLiteDatabase1 file match

@ideofunkโ€ขUpdated 6 months ago