@piing/koa-caseof
v1.0.4
Published
Koa Middleware for handling branching routes based on property in Context
Downloads
6
Readme
koa-caseof
Koa Middleware for handling branching routes based on Context
Install
npm i @piing/koa-caseof
Usage
import KoaRouter from "koa-router"
import caseof from "@piing/koa-caseof"
const router = new KoaRouter();
router.get("/items/",
authenticate,
caseof( "user.type", {
Admin: itemController.getAll,
User: itemController.getAllBelongingToUser
}))