@contextjs/routing
v25.1.0
Published
Declarative, fast, and extensible route matching for ContextJS applications.
Maintainers
Readme
@contextjs/routing
Declarative, extensible route matching and configuration for ContextJS-based applications.
Features
- Fully type-safe and fluent route configuration
- Support for literal, parameterized, optional, and catch-all route templates
- Fast route matching with scoring and early-exit optimization
- URI decoding, normalization, and edge-case tolerance
- Integration with the
Applicationclass viauseRouting()
Installation
npm i @contextjs/routingUsage
import { Application } from "@contextjs/system";
import { RouteInfo } from "@contextjs/routing";
const app = new Application();
app.useRouting();Matching Example
import { RouteService } from "@contextjs/routing";
const route = RouteService.match("home/123/details", [...routeDefinitions]);
console.log(route?.template); // "home/{id?}/details"API Reference
For detailed API documentation, please refer to the API Reference.
Testing
All features are covered by 100% unit test coverage, ensuring reliability, correctness, and long-term maintainability - so you can focus on building, not debugging.
