Unofficial Cookbook - mojolicious/mojo GitHub Wiki

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;
  ...
});