first commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { useToString } from '@vueuse/core'
|
||||
export default defineEventHandler(async (event) => {
|
||||
const query = getQuery(event)
|
||||
const search = useToString(query.search)
|
||||
|
||||
try {
|
||||
const results = await prisma.country.findMany()
|
||||
|
||||
return results.map((r) => {
|
||||
return {
|
||||
_id: r.id,
|
||||
name: r.name,
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
// Return error if fetching users fails
|
||||
return {
|
||||
status: 500,
|
||||
body: { message: 'Failed to fetch countries' },
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user