@4lch4/koa-router-printer

A Koa middleware that outputs the routes registered to the application.

Usage no npm install needed!

<script type="module">
  import 4lch4KoaRouterPrinter from 'https://cdn.skypack.dev/@4lch4/koa-router-printer';
</script>

README

@4lch4/koa-router-printer

This repo is a lightweight utility for Koa.js applications that utilize @koa/router. It outputs a two-column table containing the registered path(s) and method(s).

Examples

NOTE: These examples are also available in the examples directory.

Example 0

Printer(app, {
  displayHead: false,
  displayPrefix: true
})

Example-Screenshot

Example 1

Printer(app, {
  displayHead: true,
  displayPrefix: false
})

Example-Screenshot

Options

The module accepts two options along with the app parameter:

  • displayHead
    • Whether or not to display the HEAD method with a path.
  • displayPrefix
    • Whether or not to display the prefix ahead of each Route path.