lk-collection-convexpress
v1.0.3
Published
Convexpress routes implementing collections in the lk-architecture
Downloads
7
Readme
lk-collection-convexpress
Convexpress routes implementing collections in the lk-architecture.
Usage
import express from "express";
import convexpress from "convexpress";
import collection from "lk-collection-convexpress";
import getDispatch from "lk-dispatch";
const posts = collection({
name: "posts",
schema: {
type: "object",
properties: {/* ... */}
},
authorize: {
insert: () => ({authorized: true}),
replace: () => ({authorized: true}),
remove: () => ({authorized: true})
},
dispatchEvent: getDispatch(/* ... */),
findElement: () => ({}),
});
const convrouter = convexpress({/* ... */})
.serveSwagger()
.convroute(posts.insert)
.convroute(posts.replace)
.convroute(posts.remove);
express()
.use(convrouter)
.listen(3000);