Created
August 8, 2023 13:22
-
-
Save ology/42a133c1b8ddd953037b61eb550cc9e9 to your computer and use it in GitHub Desktop.
Can't get the /*img route to work - help?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Mojolicious::Lite -signatures; | |
use Mojo::File (); | |
get '/' => sub ($c) { | |
$c->render(template => 'index'); | |
}; | |
get '/album/*img' => sub ($c) { | |
my $file = $c->param('img'); | |
warn __PACKAGE__,' L',__LINE__,' ',,"F: $file\n"; | |
}; | |
app->start; | |
__DATA__ | |
@@ index.html.ep | |
% layout 'default'; | |
% title 'Welcome'; | |
<h1>Welcome to the Mojolicious real-time web framework!</h1> | |
@@ layouts/default.html.ep | |
<!DOCTYPE html> | |
<html> | |
<head><title><%= title %></title></head> | |
<body><%= content %></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── route.pl | |
└── public | |
└── album | |
└── 13-sided-tile.png | |
# /album/13-sided-tile.png is displayed in the browser but the '/album/*img' route is never called. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment