-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
We could supply a defineEdgeDbHandler function that could be used to wrap query builder methods:
// /server/api/blogpost.ts
const q = useEdgeDbQueryBuilder()
export default defineEdgeDbHandler(
q.BlogPost,
{
// /api/blogpost GET
select: async (blogPost, req) => {
// blogPost would be the data returned from the query build upon operation
// return of this function would be alterable if that function is defined
// if the function return is undefined, then the `blogPost` will be returned
// if the function returns something, then it will replace original return type
// the `select` as it is `GET` would support query parameters from `q.select()` via query parameters
}
// /api/blogpost POST
create: async (blogPost, req) => {
// the `create`, `update`, `delete` would support passing properties and links via JSON body
},
// /api/blogpost PATCH
update: async (blogPost, req) => {
...
},
// /api/blogpost DELETE
delete: async (blogPost, req) => {
...
}
}
)I guess it would also automatically support auth as req would automatically be passed to client used in the background.
WDYT @juni0r ?
Metadata
Metadata
Assignees
Labels
No labels