In Mojolicious (or a plugin) I would like to have a /app.js route that - in development mode - would ignore the file in ./public/app.js even if it's there, and serve a response dynamically created by a template instead.
However a basic app that looks like this:
use Mojolicious::Lite -signatures;
get '/' => sub ($c) {
$c->render(template => 'index');
};
get '/app.js' => sub ($c) {
$c->render(template => 'app', format => 'js');
};
app->start;
always serves the static file no matter what - I guess because static routes come first.
Is there a way to do this?