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

Other Useful Business Software
Earn up to 16% annual interest with Nexo. Icon
Earn up to 16% annual interest with Nexo.

Let your crypto work for you

Put idle assets to work with competitive interest rates, borrow without selling, and trade with precision. All in one platform. Geographic restrictions, eligibility, and terms apply.
Get started with Nexo.
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