From 8bd41f8df3ed1a36a85ceb5d5179ea3729ad8046 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 18 Dec 2023 23:15:01 +0100 Subject: [PATCH] create api/orders/count.get endpoint this api returns count of all orders --- server/api/orders/count.get.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 server/api/orders/count.get.ts diff --git a/server/api/orders/count.get.ts b/server/api/orders/count.get.ts new file mode 100644 index 0000000..632280d --- /dev/null +++ b/server/api/orders/count.get.ts @@ -0,0 +1,9 @@ +import { defineEventHandler } from "h3"; + +import { database } from "~/server/utils/database"; + +export default defineEventHandler(async (e) => { + return { + count: await database.order.count({}), + }; +});