Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qard/koa-method-match
Method match router for koa, does not handle path matching
https://github.com/qard/koa-method-match
Last synced: about 1 month ago
JSON representation
Method match router for koa, does not handle path matching
- Host: GitHub
- URL: https://github.com/qard/koa-method-match
- Owner: Qard
- Created: 2014-07-06T19:20:40.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-05-07T15:32:12.000Z (over 6 years ago)
- Last Synced: 2024-10-12T03:10:03.895Z (about 1 month ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# koa-method-match
Method match router for koa, does not handle path matching. It is intended to be
used with [koa-path](https://www.npmjs.org/package/koa-path), but is not tied to it.## Usage
```js
var method = require('koa-method-match')
var path = require('koa-path')()// You can simply pass the method in as a string
app.use(method('get', path('/user/:id', handler)))// Or you can use method types as functions
var post = method.post
var get = method.getapp.use(post(path('/user', handler)))
app.use(get(path('/user/:id', handler)))
```