Skip to content

Conversation

@FCO
Copy link

@FCO FCO commented Sep 29, 2025

It adds Str :$name to the http functions (get, put, post, etc) and a Str $.name to RouteHandler class.

On Cro::HTTP::Router it adds Handler %.named-routes and Handler %.generated-named-routes to store the handlers indexed by name (passed or generated).

It also adds the methods generate-name to be able to generate a name if one wasnt provided, and path-template and path to, having the Handler (you can gat using the new exported sub endpoint(Str $name)) be able to get it's path-template and it's path (receiving named parameters to populate the vars).

It also alters redirect to, if the location passed is a name of an endpoint, uses its path (it also accepts :%params to be used to populate the path) as location to be redirected (unless also passed :!named-endpoint).

And finally it also exports a sub called list-routes that returns a string listing all routes and their names.

It adds `Str :$name` to the `http` functions (`get`, `put`, `post`, etc)
and a `Str $.name` to `RouteHandler` class.

On `Cro::HTTP::Router` it adds `Handler %.named-routes` and `Handler %.generated-named-routes`
to store the handlers indexed by name (passed or generated).

It also adds the methods `generate-name` to be able to generate a name
if one wasnt provided, and `path-template` and `path` to, having the
`Handler` (you can gat using the new exported sub `endpoint(Str $name)`)
be able to get it's path-template and it's path (receiving named
parameters to populate the vars).

It also alters `redirect` to, if the location passed is a name of an
endpoint, uses its path (it also accepts `:%params` to be used to
populate the path) as location to be redirected (unless also passed
`:!named-endpoint`).

And finally it also exports a sub called `list-routes` that returns a
string listing all routes and their names.
@japhb
Copy link
Contributor

japhb commented Oct 1, 2025

Closing in favor of #208

@japhb japhb closed this Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants