Koa Path Match
const route = /* options passed to path-to-regexp */app
Or you can create middleware per method:
paths are just like Express routes.
fns is either a single middleware
or nested arrays of middleware, just like Express.
const router = route(path)
When you don't set
fns in the
route() function, a router instance is returned.
Define a middleware just for a specific method.
nextis not passed as a parameter. I consider this an anti-pattern in Koa - one route/method, one function.
Any keys defined in the path will be set to
overwriting any already existing keys defined.