@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 18 lines 626 Bytes
Raw
1 import type { Hyperdrive } from "@cloudflare/workers-types";
2 import { Client } from "pg";
3
4 /** Queries the private Aurora database through Hyperdrive. */
5 export default {
6 async fetch(_request: Request, env: { DB: Hyperdrive }): Promise<Response> {
7 const client = new Client({ connectionString: env.DB.connectionString });
8 try {
9 await client.connect();
10 const result = await client.query("select version()");
11 return Response.json(result.rows[0]);
12 } catch (error) {
13 return new Response(String(error), { status: 500 });
14 } finally {
15 await client.end().catch(() => {});
16 }
17 },
18 };