forked from Wroclaw/WorkshopTasker
13 lines
366 B
TypeScript
13 lines
366 B
TypeScript
|
/* global defineEventHandler, createError */
|
||
|
|
||
|
import { database, data } from "~/server/utils/database";
|
||
|
|
||
|
export default defineEventHandler(async (e) => {
|
||
|
const [[data]] = await database.query(
|
||
|
"SELECT COUNT(*) as `count` FROM `clients`",
|
||
|
) as unknown as data<{count: number}>;
|
||
|
|
||
|
if (!data) throw createError("Database returned no rows");
|
||
|
return data;
|
||
|
});
|