2.2.0 • Published 4 months ago
@mutoe/koam-router v2.2.0
Koam-router
Implement a simple Koa-like router to create a web application.
THIS FRAMEWORK HAVE NOT BEEN STRICTLY TESTED, PLEASE DO NOT USE IT IN PRODUCTION ! 许多功能未经严格测试,请勿用于生产目的!
Usage
import Koa from '@mutoe/koam-core'
import Router from '@mutoe/koam-router'
const app = new Koa()
const router = new Router()
app.use(router.routes())
Roadmap
new Route([options])
options.prefix
options.exclusive
options.host
router.<get|post|put|patch|delete|all>(path, ...middlewares)
- Named routes
- Match host
- Multiple middlewares
- Path matching (lightweight
path-to-regexp
)- named match
- unnamed match
- custom pattern match
- modifiers
context.params
router.routes()
- Nested routes
router.use([path], ...middlewares)
router.use([path], ...anotherRouter.routes())
router.prefix(path)
router.allowedMethods([options])
options.throw
options.notImplemented
options.methodNotAllowed
router.redirect(source, destination, [status])
router.route(name)
router.url(name, params, [options])
router.url(name, ...paramStrings, [options])
options.query
- static method
Router.url(path, params, [options])
Router.url(path, ...paramStrings, [options])
options.query
router.param(param, ...middlewares)
2.2.0
4 months ago
2.0.2
10 months ago
2.1.0
9 months ago
2.0.1
11 months ago
2.0.0
11 months ago
2.0.0-alpha.0
11 months ago
1.1.1
11 months ago
1.1.0
11 months ago
1.0.1
12 months ago
1.0.0
12 months ago
0.3.2
12 months ago
0.3.1
1 year ago
0.3.0
1 year ago
0.2.4
1 year ago
0.2.3
1 year ago
0.2.2
1 year ago
0.2.1
1 year ago
0.2.0
1 year ago
0.1.4
1 year ago