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%22Image%20title%22?q=database&page=635&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 7016 results for "database"(1942ms)

AlwaysHereBackendREADME.md6 matches

@ninadxc•Updated 2 months ago
1# Database
2
3This app uses [Val Town SQLite](https://docs.val.town/std/sqlite/) to manage data. Every Val Town account comes with a free SQLite database, hosted on [Turso](https://turso.tech/). This folder is broken up into two files:
4
5* `migrations.ts` - code to set up the database tables the app needs
6* `queries.ts` - functions to run queries against those tables, which are imported and used in the main Hono server in `/backend/index.ts`
7
8## Migrations
9
10In `backend/database/migrations.ts`, this app creates a new SQLite table `reactHonoStarter_messages` to store messages.
11
12This "migration" runs once on every app startup because it's imported in `index.ts`. You can comment this line out for a slight (30ms) performance improvement on cold starts. It's left in so that users who fork this project will have the migration run correctly.
13
14SQLite has much more limited support for altering existing tables as compared to other databases. Often it's easier to create new tables with the schema you want, and then copy the data over. Happily LLMs are quite good at those sort of database operations, but please reach out in the [Val Town Discord](https://discord.com/invite/dHv45uN5RY) if you need help.
15
16## Queries
17
18The queries file is where running the migrations happen in this app. It'd also be reasonable for that to happen in index.ts, or as is said above, for that line to be commented out, and only run when actual changes are made to your database schema.
19
20The queries file exports functions to get and write data. It relies on shared types and data imported from the `/shared` directory.

reactHonoExamplemigrations.ts1 match

@varun1352•Updated 2 months ago
21
22 However, you should know that SQLite has much more limited
23 support for altering existing tables as compared to other databases.
24 Often it's easier to create new tables with the schema you want, and then
25 copy the data over. */

reactHonoExamplegoogleOAuth.ts1 match

@varun1352•Updated 2 months ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2import { Hono } from "npm:hono";
3import { USERS } from "../database/migrations.ts"; // Make sure migrations defines this table
4
5const CLIENT_ID = "your_google_client_id";

AlwaysHereindex.ts3 matches

@varun1352•Updated 2 months ago
9import userApi from "./api/user.ts";
10import googleOAuth from "./auth/googleOAuth.ts";
11import { createTables } from "./database/migrations.ts";
12const app = new Hono();
13
16});
17
18app.get("/setupDatabase", async c => {
19 createTables();
20 return c.text("Database Setup Successful");
21});
22app.route("/auth/google", googleOAuth);

AlwaysHeregoogleOAuth.ts1 match

@varun1352•Updated 2 months ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2import { Hono } from "npm:hono";
3import { USERS } from "../database/migrations.ts"; // Make sure migrations defines this table
4
5const CLIENT_ID = "your_google_client_id";

AlwaysHereuser.ts1 match

@varun1352•Updated 2 months ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2import { Hono } from "npm:hono";
3import { USERS } from "../database/migrations.ts";
4
5const user = new Hono();

AlwaysHeretranscripts.ts1 match

@varun1352•Updated 2 months ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2import { Hono } from "npm:hono";
3import { CONVERSATIONS } from "../database/migrations.ts";
4
5const transcripts = new Hono();

AlwaysHererecordings.ts1 match

@varun1352•Updated 2 months ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2import { Hono } from "npm:hono";
3import { RECORDINGS } from "../database/migrations.ts";
4
5const recordings = new Hono();

AlwaysHerefriends.ts1 match

@varun1352•Updated 2 months ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2import { Hono } from "npm:hono";
3import { FRIENDS } from "../database/migrations.ts";
4
5const friends = new Hono();

AlwaysHerechat.ts1 match

@varun1352•Updated 2 months ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2import { Hono } from "npm:hono";
3import { CONVERSATIONS } from "../database/migrations.ts";
4
5const chat = new Hono();

bookmarksDatabase

@s3thi•Updated 3 months ago

sqLiteDatabase1 file match

@ideofunk•Updated 6 months ago