From b17771755d1def5125cf08092f65a4beb819aae1 Mon Sep 17 00:00:00 2001 From: Xeovalyte Date: Mon, 5 Jun 2023 09:34:22 +0200 Subject: [PATCH] feat: Added get all users. closes #16 --- webv2/server/api/users/index.get.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 webv2/server/api/users/index.get.ts diff --git a/webv2/server/api/users/index.get.ts b/webv2/server/api/users/index.get.ts new file mode 100644 index 0000000..1ec7a8a --- /dev/null +++ b/webv2/server/api/users/index.get.ts @@ -0,0 +1,9 @@ +export default defineEventHandler(async () => { + try { + return await UserModel.find() + } catch (e) { + console.error('Failed to get users', e) + + throw createError({ statusCode: 500, statusMessage: 'Failed to get users' }) + } +})