[question] How to implements HTTP 405 and 501 support ?
mamatsunami opened this issue · comments
Yann-Fanch Guyot commented
Hi,
I try to use ".allowedMethods()" (from koa-router) on a koa-joi-router instance, but it is undefined. The list of features includes "HTTP 405 and 501 support", is it really implemented ?
Thanks
Nicholai Nissen commented
Internally koa-joi-router uses the npm module "methods" that wraps around http.METHODS
. You can use either to determine available methods.
Yann-Fanch Guyot commented
Oh ! I didn't see that a related koa-router instance is available on the router
property of a koa-joi-router instance. From the main example in README.md, to activate 405/501 support, just got to do :
...
const app = new koa();
app.use(public.middleware());
app.use(public.router.allowedMethods());
app.listen(3000);
Thanks for your time @Nicholaiii ;)