From d0fe4fb8e45405c13d98a15a4596b5b5e25f4994 Mon Sep 17 00:00:00 2001 From: Lukas Lanzner Date: Fri, 4 Oct 2024 10:10:19 +0200 Subject: [PATCH] test server db stuff --- server/api/calc.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 server/api/calc.ts diff --git a/server/api/calc.ts b/server/api/calc.ts new file mode 100644 index 0000000..fc8c9a5 --- /dev/null +++ b/server/api/calc.ts @@ -0,0 +1,9 @@ +import {serverSupabaseClient} from '#supabase/server' + +export default defineEventHandler(async (event) => { + const client = await serverSupabaseClient(event) + const {data} = await client.from('calculations').select('*') + await client.from('calculations').insert({operand: '+', left: 10, right: 5, result: 10+5}) + + return {data: data} +})