NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm
A tiny, zero-dependency router, designed to make beautiful APIs in any environment.
Latest stable
6.0.0
Last release 5 months ago
08 Jun 2026
Ships unpredictably
gaps range from 8 days to 11 months
Some releases are documented
notes for 22 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
271 releases · first in 2020
Drag across the ruler to compare, or tap a release to open it.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →
legibility. Torn. Don't think we would have to count the decision on this one as a breaking change (if we opt for "routes"), because the existing patt…
options are now:
base?: string - optional base pathroutes?: any[] - optional array of routes (for introspection or preloading with advanced regex)Request definition to address #47router.routes array. Pretty sick!// EXAMPLE 1 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
it('allows preloading advanced routes', async () => {
const basicHandler = jest.fn(req => req.params)
const customHandler = jest.fn(req => req.params)
const router = Router({
routes: [
[ 'GET', /^\/test\.(?<x>[^/]+)\/*$/, [basicHandler] ],
[ 'GET', /^\/custom-(?<custom>\d{2,4})$/, [customHandler] ], // match 2 to 4 digits only
]
})
await router.handle(buildRequest({ path: '/test.a.b' }))
expect(basicHandler).toHaveReturnedWith({ x: 'a.b' })
await router.handle(buildRequest({ path: '/custom-12345' }))
expect(customHandler).not.toHaveBeenCalled() // custom route mismatch
await router.handle(buildRequest({ path: '/custom-123' }))
expect(customHandler).toHaveReturnedWith({ custom: '123' }) // custom route hit
})
// EXAMPLE 2 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
it('allows loading advanced routes after config', async () => {
const handler = jest.fn(req => req.params)
const router = Router()
// allows manual loading (after config)
router.routes.push([ 'GET', /^\/custom2-(?<custom>\w\d{3})$/, [handler] ])
await router.handle(buildRequest({ path: '/custom2-a456' }))
expect(handler).toHaveReturnedWith({ custom: 'a456' }) // custom route hit
})
DISCUSSION: If we change r to routes, and prevent the prebuild.js from mangling it, the filesize does grow (405b --> 409b), but so does the legibility around this weird introspection. Thoughts? I'm all for absolute minimum filesize, but... legibility. Torn. Don't think we would have to count the decision on this one as a breaking change (if we opt for "routes"), because the existing pattern isn't documented, and is hopefully only used in debugging patterns at most. Regardless of the path chosen here, documentation will be added to disclose this functionality.
UPDATE: unless there's strong objection, I'm opting for readability over ultimate filesize... router.routes it is
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
…in the previous release, thus the need for a breaking change/major release.
TLDR; Most people will not be affected at all and can upgrade without issue
In 2.x, itty changed the handling of the *all channel from executing before all other methods (effectively an upstream catch-all method), to handling in-order like all other routes, just bypassing the method match (therefore matching any method type). While this could technically be considered a fix, the behavior COULD have been planned around intentionally in the previous release, thus the need for a breaking change/major release.
The following example demonstrates the changes in the all channel execution:
router
.all('*', middleware) // applied before
.get('/foo', () => new Response('middleware is applied'))
// is equivalent to this "backwards" example, because the "all" is executed first
router
.get('/foo', () => new Response('middleware is applied'))
.all('*', middleware) // applied before, despite being registered afterwards
// leading to this weird behavior... where a final "catch-all" will in fact intercept all previous routes...
router
.all('*', middleware) // still applies first...
.get('/foo', () => new Response('This route will NEVER match... RIP.'))
.all('*', () => new Response('Not found', { status: 404 })) // will catch everything before the previous line
router
.all('*', middleware) // still applies first...
.get('/foo', () => new Response('This route WILL properly match! woohoo!... RIP'))
.all('*', () => new Response('Not found', { status: 404 })) // will only catch if no previous match... as expected.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.