This commit is contained in:
bigdeejay
2025-01-22 17:58:47 +09:00
parent ef90ee4042
commit 19a7d45b7b
63 changed files with 7108 additions and 0 deletions

22
app/query/route.ts Normal file
View File

@@ -0,0 +1,22 @@
import { db } from "@vercel/postgres";
const client = await db.connect();
async function listInvoices() {
const data = await client.sql`
SELECT invoices.amount, customers.name
FROM invoices
JOIN customers ON invoices.customer_id = customers.id
WHERE invoices.amount = 666;
`;
return data.rows;
}
export async function GET() {
try {
return Response.json(await listInvoices());
} catch (error) {
return Response.json({ error }, { status: 500 });
}
}