|
|
# As_string()
|
|
|
|
|
|
Returns a report of the defined routes, in order of definition. Return value type is [Str](https://docs.perl6.org/type/Str).
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
Typical usage:
|
|
|
|
|
|
```perl
|
|
|
my %payload = controller => 'Entry';
|
|
|
my $route = Router::Right.new;
|
|
|
$route.add(
|
|
|
:name('entry'),
|
|
|
:path('/entries/{year}/{month}'),
|
|
|
:payload( %payload ),
|
|
|
);
|
|
|
$route.as_string.say;
|
|
|
```
|
|
|
## Output example
|
|
|
|
|
|
Output string is designed as table with columns:
|
|
|
|
|
|
- route name;
|
|
|
|
|
|
- allowed methods (`*` — all methods are allowed);
|
|
|
|
|
|
- route path;
|
|
|
|
|
|
- route payload.
|
|
|
|
|
|
Typical output:
|
|
|
|
|
|
```
|
|
|
restrictedmatch * /foo/{year:\d+}/bar {controller => Foo}
|
|
|
mergecontent * /entries/{year}/{month}/{day} {controller => Foo}
|
|
|
dl2 * /dl/{file}{format} {controller => Foo}
|
|
|
allowtest1 DELETE,GET,PUT /allow/methods/test {controller => Foo}
|
|
|
allowtest2 GET,POST /allow/methods/test/2 {controller => Foo}
|
|
|
allowtest3 POST /allow/methods/test/3 {action => Bar, controller => Foo}
|
|
|
``` |
|
|
\ No newline at end of file |