NAME

Dancer2::Plugin::BeforeRoute - A before hook for a specify route or routes

USAGE

use Dancer2::Plugin::BeforeRoute;

before_route get => "/", sub {
    var before_run => "homepage";
};

before_route ["get", "post"] => "/", sub {
    var before_run => "homepage";
};

get "/" => sub {
    ## Return "homepage"
    return var "before_run";
};

before_route get => "/foo", sub {
    var before_run => "foo"
};

get "/foo" => sub {
    ## Return "foo"
    return var "before_run";
};

before_template_route 

DESCRIPTION

Dancer provides hook before to do everythings before going any route.

This plugin is to provide a little bit more specifically hook before route or route(s) executed.

AUTHOR

Michael Vu, <micvu at cpan.org>

BUGS

Please report any bugs or feature requests to bug-dancer-plugin-beforeroute at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dancer2::Plugin::BeforeRoute. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

   perldoc Dancer2::Plugin::BeforeRoute

You can also look for information at:

ACKNOWLEDGEMENTS

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.