This commit is contained in:
2026-05-12 17:35:38 +03:00
parent d9ffcb4b92
commit e3f3e62482
51 changed files with 882 additions and 3413 deletions
+7 -7
View File
@@ -1,20 +1,20 @@
import postgres from 'postgres';
import postgres from "postgres";
const sql = postgres(process.env.POSTGRES_URL!, { ssl: 'require' });
const sql = postgres(process.env.POSTGRES_URL!, { ssl: "require" });
async function listInvoices() {
const data = await sql`
const data = await sql`
SELECT invoices.amount, customers.name
FROM invoices
JOIN customers ON invoices.customer_id = customers.id
WHERE invoices.amount = 666;
`;
return data;
return data;
}
export async function GET() {
export async function GET() {
try {
return Response.json(await listInvoices());
return Response.json(await listInvoices());
} catch (error) {
return Response.json({ error }, { status: 500 });
return Response.json({ error }, { status: 500 });
}
}