7The **client-side entrypoint** is `/frontend/index.html`, which in turn imports `/frontend/index.tsx`, which in turn imports the React app from `/frontend/components/App.tsx`.
8
9[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.
7The **client-side entrypoint** is `/frontend/index.html`, which in turn imports `/frontend/index.tsx`, which in turn imports the React app from `/frontend/components/App.tsx`.
8
9[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.
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {
13 todayHits = hits.todayHits;
14 } catch (e) {
15 console.log("Caught database error: ", e);
16 }
17 return new Response(
5import ValTown from "npm:@valtown/sdk";
6import SocialData from "../sdk/index.ts";
7import { setupDatabase, USAGE_TABLE } from "./database.ts";
8import { searchTwitterRoute } from "./routes/search.ts";
9
14
15// Uncomment this if you're forking this project:
16// await setupDatabase()
17
18// https://socialdata.gitbook.io/docs/pricing
5import ValTown from "npm:@valtown/sdk";
6import SocialData from "../sdk/index.ts";
7import { setupDatabase, USAGE_TABLE } from "./database.ts";
8import { searchTwitterRoute } from "./routes/search.ts";
9
14
15// Uncomment this if you're forking this project:
16// await setupDatabase()
17
18// https://socialdata.gitbook.io/docs/pricing
3export const USAGE_TABLE = "socialDataProxy_usage_2";
4
5export async function setupDatabase() {
6 await sqlite.execute(`
7 CREATE TABLE IF NOT EXISTS ${USAGE_TABLE} (
1# Get a DuckDB database
2
3This method sets up a [duckdb-wasm](https://github.com/duckdb/duckdb-wasm) database that you can then use to store and retrieve data.
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {
5import ValTown from "npm:@valtown/sdk";
6import SocialData from "../sdk/index.ts";
7import { setupDatabase, USAGE_TABLE } from "./database.ts";
8import { searchTwitterRoute } from "./routes/search.ts";
9
14
15// Uncomment this if you're forking this project:
16// await setupDatabase()
17
18// https://socialdata.gitbook.io/docs/pricing