Remodeled database and api to prepare for move
This commit is contained in:
18
server/api/characters/index.get.ts
Normal file
18
server/api/characters/index.get.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { serverSupabaseClient } from "#supabase/server";
|
||||
import type { Character } from "~/models/Characters";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const client = await serverSupabaseClient(event)
|
||||
|
||||
return client.from('characters')
|
||||
.select(`
|
||||
id,
|
||||
name,
|
||||
description,
|
||||
birth,
|
||||
death,
|
||||
wiki,
|
||||
characters_category (id, name)
|
||||
`)
|
||||
.returns<Character[]>()
|
||||
})
|
||||
Reference in New Issue
Block a user