koajs / router

Router middleware for Koa. Maintained by @forwardemail and @ladjs.
MIT License
862 stars 176 forks source link

Add throw option to the routes middleware #49

Closed thewilkybarkid closed 1 month ago

thewilkybarkid commented 4 years ago

The allowedMethods middleware has a throw option, I'd like to add the same to routes. For now I have a custom middleware (https://github.com/libero/article-store/blob/master/src/middleware/routing.ts), but it'd be great to have it built in.

kravorkid commented 1 year ago

You can use the ctx.throw([status], [msg], [properties]) from koa here the full documentation