Skip to main content
The Dev Helper provides utilities for inspecting routes and middleware during development.

Import

import { showRoutes, inspectRoutes, getRouterName } from 'hono/dev'

Functions

showRoutes()

Print all routes to the console.
function showRoutes(app: Hono, options?: ShowRoutesOptions): void
app
Hono
required
The Hono application instance
options
ShowRoutesOptions
Display options
Example
import { Hono } from 'hono'
import { showRoutes } from 'hono/dev'

const app = new Hono()
app.get('/api/users', (c) => c.json([]))
app.post('/api/users', (c) => c.json({}))

showRoutes(app)
// Output:
// GET   /api/users
// POST  /api/users

inspectRoutes()

Get route information as an array.
function inspectRoutes(app: Hono): RouteData[]
app
Hono
required
The Hono application instance
return
RouteData[]
Array of route information objects
Example
import { inspectRoutes } from 'hono/dev'

const routes = inspectRoutes(app)
routes.forEach(route => {
  console.log(`${route.method} ${route.path}`)
  console.log(`  Middleware count: ${route.middleware.length}`)
})

getRouterName()

Get the name of the router being used.
function getRouterName(app: Hono): string
app
Hono
required
The Hono application instance
return
string
The router name (e.g., ‘SmartRouter’, ‘RegExpRouter’)

Types

type ShowRoutesOptions = {
  verbose?: boolean
  colorize?: boolean
}

type RouteData = {
  path: string
  method: string
  name: string
  isMiddleware: boolean
  middleware: string[]
}

Verbose Mode

import { showRoutes } from 'hono/dev'

showRoutes(app, { verbose: true })
// Output includes middleware information:
// GET   /api/users
//       [logger, cors, auth]

Build docs developers (and LLMs) love