hono icon indicating copy to clipboard operation
hono copied to clipboard

feat(core,router): expose Context and add LinearRouter.matchRoute utility

Open Digital39999 opened this issue 3 months ago • 0 comments

This PR introduces two public APIs that were previously internal. It also resolves #4409.

  • Context class - exported from index.ts for advanced use cases (testing, unified request handling, extensions).

  • LinearRouter.matchRoute static method

    • Abstraction of the internal matching logic.
    • Allows for comprehensive testing and reusability of route-matching behavior.
    • Covers exact paths, wildcards, parameters, regex patterns, edge cases, and unsupported patterns.

The author should do the following, if applicable

  • [x] Add tests
  • [x] Run tests
  • [x] bun run format:fix && bun run lint:fix to format the code
  • [x] Add TSDoc/JSDoc to document the code

Digital39999 avatar Sep 16 '25 01:09 Digital39999