The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: run prettier.
Thor 雷神 Schaeff00a57d4d51a1
diff --git a/examples/edge-functions/supabase/functions/postgres-on-the-edge/index.ts b/examples/edge-functions/supabase/functions/postgres-on-the-edge/index.tsindex 88724f203e4..6ce14f6990d 100644--- a/examples/edge-functions/supabase/functions/postgres-on-the-edge/index.ts+++ b/examples/edge-functions/supabase/functions/postgres-on-the-edge/index.ts@@ -1,43 +1,43 @@-import * as postgres from "https://deno.land/x/[email protected]/mod.ts";-import { serve } from "https://deno.land/[email protected]/http/server.ts";+import * as postgres from 'https://deno.land/x/[email protected]/mod.ts'+import { serve } from 'https://deno.land/[email protected]/http/server.ts'// Get the connection string from the environment variable "DATABASE_URL"-const databaseUrl = Deno.env.get("DATABASE_URL")!;+const databaseUrl = Deno.env.get('DATABASE_URL')!// Create a database pool with three connections that are lazily established-const pool = new postgres.Pool(databaseUrl, 3, true);+const pool = new postgres.Pool(databaseUrl, 3, true)serve(async (_req) => {try {// Grab a connection from the pool- const connection = await pool.connect();+ const connection = await pool.connect()try {// Run a query- const result = await connection.queryObject`SELECT * FROM animals`;- const animals = result.rows; // [{ id: 1, name: "Lion" }, ...]- console.log(animals);+ const result = await connection.queryObject`SELECT * FROM animals`+ const animals = result.rows // [{ id: 1, name: "Lion" }, ...]+ console.log(animals)// Encode the result as pretty printed JSONconst body = JSON.stringify(animals,- (key, value) => (typeof value === "bigint" ? value.toString() : value),+ (_key, value) => (typeof value === 'bigint' ? value.toString() : value),2- );+ )// Return the response with the correct content type headerreturn new Response(body, {status: 200,headers: {- "Content-Type": "application/json; charset=utf-8",+ 'Content-Type': 'application/json; charset=utf-8',},- });+ })} finally {// Release the connection back into the pool- connection.release();+ connection.release()}} catch (err) {- console.error(err);- return new Response(String(err?.message ?? err), { status: 500 });+ console.error(err)+ return new Response(String(err?.message ?? err), { status: 500 })}-});\ No newline at end of file+})