add: data from MongoDB
Retrieve Data from MongoDB
This commit is contained in:
parent
628659c39d
commit
ae0f6cb620
9 changed files with 210 additions and 9 deletions
9
server/api/products/index.get.ts
Normal file
9
server/api/products/index.get.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
export default defineEventHandler(async () => {
|
||||
try {
|
||||
return await ProductSchema.find()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
return []
|
||||
}
|
||||
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue