Easy, rich, and fully validated koa routing. koa-joi-router returns a constructor that you use to define your routes. The design is such that you construct multiple router instances, one for each section of your application which you then add as koa middleware. The route definition for the currently matched route is available via ctx.state.route. This object is not the exact same route definition object that was passed into koa-joi-router, nor is it used internally - any changes made to this object will not have an effect on your running application but is available to meet your introspection needs. Validating the output body and/or headers your service generates on a per-status-code basis is supported. This comes in handy when contracts between your API and client are strict e.g. any change in response schema could break your downstream clients. In a very active codebase, this feature buys you stability. If the output is invalid, an HTTP status 500 will be used.

Features

  • Built in input validation using joi
  • Built in output validation using joi
  • Built in body parsing using co-body and await-busboy
  • Exxposed route definitions for later analysis
  • String path support
  • HTTP 405 and 501 support

Project Samples

Project Activity

See All Activity >

Categories

Frameworks

License

MIT License

Follow joi-router

joi-router Web Site

You Might Also Like
Our Free Plans just got better! | Auth0 by Okta Icon
Our Free Plans just got better! | Auth0 by Okta

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your secuirty. Auth0 now, thank yourself later.
Try free now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of joi-router!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Frameworks

Registered

2024-01-10