Skip to content

Unofficial Cookbook

Stefan Adams edited this page Dec 24, 2015 · 1 revision

Rearranging Routes

This will allow you to put a route at the beginning of the stack. Typically, you might add_child but that will push the new route to the end of the stack.

unshift @{app->routes->children}, Mojolicious::Routes::Route->new('/')->to(cb=>sub {
  my $c = shift;
  ...
});