I have application it works fine. But now we decide to move it under /api
path. So I use detour
my $r = $self->routes;
# Application is always under /api/v1, /api/v2 etc. path
$r = $r->any( '/api/:api', [ api => qr/v\d+/ ] )->detour( 'MyApp' );
$r->get( '/users/me' )->to( 'user#show_me' );
But after this nothing works. Request to site.domain/api/v1
cause application to fall into endless loop.
There is also Mojolicious::Plugin::Mount but it only useful to mount another one application under specified route.
This guide also does not resolve problem.
This line should be fixed:
Update
As it was documented:
If you run
myapp.pl routes -v
you will see:When request come it will be checked against this regex:
Where only
/users/me
will be captured in thepath