[ANN] Routes v2.0.0 released

Hi!

I’d like to announce release of version 2.0.0 of routes to the ocaml package registry.

Routes provides a DSL for typed bi-directional URI dispatch. It allows writing route definitions that can be used for both matching, and printing URI paths. The internal representation of the router uses a trie to perform route matching.

Changes since the last opam release:

New updates

  • use ppx_expect for tests.
  • A new route function is available and is an alias for @--> which is used to connect a route pattern to a “handler”.

Breaking changes

  • Drop support for OCaml 4.05-4.07
  • Switch to a new model for trailing slash handling. In routes 1.0.0 users needed to be careful about using /? and //? as the former would only match routes without a trailing slash, and the latter would enforce a trailing slash.
    • Users only need to use /? to end routes, and it will cover both routes ending with trailing slashes and without
    • The type used for representing match results has more information about whether it was an exact match, or if it was a match but the input target had a trailing slash at the end.
    • MatchWithTrailingSlash informs the user that the current target was considered a match, but that the target has an additional trailing slash

Examples of how to use the library are available in the tests and a small demo

Documentation can be found here

10 Likes

wow, no dependencies!

1 Like