Router::Right

Framework-agnostic URL routing engine for web applications in Raku

Advanced URL router in Raku

Advanced, framework-agnostic URL routing engine for web applications in Raku programming language:

Synopsys

use Router::Right;

my $route = Router::Right.new;

$route.add(
    :name( 'dynaroute' ),
    :path( 'GET /dynamic/{id:<[\d]>+}/{tag}/{item}' ),
    :payload( 'Dynamic#Route' ),
);

if (my %m = $route.match(%*ENV<REQUEST_URI> || q{})) {
    %m.gist.say;
}
else {
    $route.error.say;
}

Methods

  • new() — returns a new Router::Right instance;

  • add() — defines a new route;

  • match() — attempts to find a route that matches the supplied URL;

  • error() — returns the error code of the last failed match;

  • allowed_methods() — returns the array of allowed methods for a given route;

  • url() — constructs a URL from the route;

  • as_string() — returns a report of the defined routes, in order of definition;

  • with() — helper method to share information across multiple routes;

  • resource() — adds routes to create, read, update, and delete a given resource;

  • route() — returns route details hash.

Examples

Wiki pages

Full documentation is available at Router::Right wiki pages.

License

Router::Right module is free and open source software, so you can redistribute it and/or modify it under the terms of the Artistic License 2.0.

Author

Please contact me via Matrix, LinkedIn or narkhov.pro.

Credits

This module was inspired by origin Perl5 Router::Right developed by @mla. Check it out at Github.

Router::Right v0.0.66

Framework-agnostic URL routing engine for web applications in Raku

Authors

  • Konstantin Narkhov

License

Artistic-2.0

Dependencies

P5quotemeta

Test Dependencies

Provides

  • Router::Right
  • Router::Right::Submapper

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.