Repository navigation
Add Support for Express 5 and Remove Support for Express 4 - #77
Megapixel99 wants to merge 8 commits into
Conversation
|
This PR is dependent on |
3759e8c to
ef0a065
Compare
Replace the getRoutes() call from the bjohansebas/router fork with the listRoutes() API merged in pillarjs/router#174, and depend on the released router ^2.2.0. When the installed router has no listRoutes(), record mount paths on use() layers so nested routers keep their prefixes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
This PR now uses the listRoutes() method that was merged into pillarjs/router in pillarjs/router#174, replacing the getRoutes() method from the earlier fork, and depends on the released router ^2.2.0 instead of a git branch. Until a router release includes listRoutes(), the library falls back to recording mount paths when routers are mounted with use(), so nested routers keep their prefixes on router 2.2.0. Once a release ships, Express 5 installs will use the official API automatically with no further changes. Route handlers are still read from each route’s stack, because listRoutes() exposes paths, methods and mounted routers but not handlers. All 38 tests pass against both router 2.2.0 and the current router main branch. |
Despite the initial hope of this being a small pull request, there were a lot of required changes to improve the readability of the code and support Express 5. I tried to comment the code as best I could but if something looks off, please add a comment in the PR.
Breaking Changes:
Major Changes:
lib/generate-doc.jsexpressto the latest versionexpressa peer dependencyrouterto feat: add listRoutes method to list registered routes pillarjs/router#174 (so we can accessgetRoutes())Minor Changes:
_moreRoutes.jsexternal route #74lib/validate.jswith code found here: fix: ensure req.query is writable vercel/next.js#81573 (comment) so we can coercereq.queryandreq.params(req.queryandreq.paramsare read only in Express 5 by default)