1.0.4 • Published 5 years ago
@piing/koa-caseof v1.0.4
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
}))