Skip to content

lk-architecture/lk-collection-convexpress

Repository files navigation

npm version Build Status codecov.io Dependency Status devDependency Status

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);

About

Convexpress routes implementing collections in the lk-architecture

Resources

License

Stars

Watchers

Forks

Packages

No packages published