From 41115261a180e4ec310fef5de2c30063b8ff4f20 Mon Sep 17 00:00:00 2001 From: Fabio Benedetti Date: Tue, 19 Nov 2024 08:24:41 +0100 Subject: [PATCH 1/2] add example query --- dashboard/starter-example/app/query/route.ts | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 dashboard/starter-example/app/query/route.ts diff --git a/dashboard/starter-example/app/query/route.ts b/dashboard/starter-example/app/query/route.ts new file mode 100644 index 00000000..3fcbf51f --- /dev/null +++ b/dashboard/starter-example/app/query/route.ts @@ -0,0 +1,26 @@ +// 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() { + return Response.json({ + message: + "Uncomment this file and remove this line. You can delete this file when you are finished.", + }); + // try { + // return Response.json(await listInvoices()); + // } catch (error) { + // return Response.json({ error }, { status: 500 }); + // } +} From 5d658298e9b9e5b896e65bce2bbea81e847f188c Mon Sep 17 00:00:00 2001 From: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:45:50 +0000 Subject: [PATCH 2/2] prettier-fix --- dashboard/starter-example/app/query/route.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dashboard/starter-example/app/query/route.ts b/dashboard/starter-example/app/query/route.ts index 3fcbf51f..7810c0e9 100644 --- a/dashboard/starter-example/app/query/route.ts +++ b/dashboard/starter-example/app/query/route.ts @@ -14,13 +14,13 @@ // } export async function GET() { - return Response.json({ - message: - "Uncomment this file and remove this line. You can delete this file when you are finished.", - }); - // try { - // return Response.json(await listInvoices()); - // } catch (error) { - // return Response.json({ error }, { status: 500 }); - // } + return Response.json({ + message: + 'Uncomment this file and remove this line. You can delete this file when you are finished.', + }); + // try { + // return Response.json(await listInvoices()); + // } catch (error) { + // return Response.json({ error }, { status: 500 }); + // } }