Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/piing-as/koa-caseof
Koa Middleware for handling branching routes based on property in Context
https://github.com/piing-as/koa-caseof
koa koa2 middleware nodejs router server
Last synced: 10 days ago
JSON representation
Koa Middleware for handling branching routes based on property in Context
- Host: GitHub
- URL: https://github.com/piing-as/koa-caseof
- Owner: piing-as
- Created: 2019-05-24T11:54:39.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T17:42:44.000Z (about 2 years ago)
- Last Synced: 2024-04-25T04:42:27.784Z (10 months ago)
- Topics: koa, koa2, middleware, nodejs, router, server
- Language: JavaScript
- Homepage:
- Size: 58.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# koa-caseof
Koa Middleware for handling branching routes based on Context
### Install
```bash
npm i @piing/koa-caseof
```### Usage
```typescriptimport 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
}))```