lk-collection-convexpress

1.0.3 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i lk-collection-convexpress

Weekly Downloads

4

Version

1.0.3

License

Apache-2.0

Last publish

Collaborators

  • pscanf