[Dancer-users] trouble with routes... related to ./public handling?

Richard Huxton dev at archonet.com
Mon Oct 31 09:18:06 CET 2011


On 31/10/11 05:30, Joel Roth wrote:
>
> [1] http://mydomain.com/audio
> [2] http://mydomain.com/audio/foo
>
> URL [1] is converted to the file path ./pages/audio.txt,
> which is rendered from Markdown to HTML and returned.
>
> I expect URL [2] to similarly return a rendered form
> of ./pages/audio/foo.txt, but what I receive is 404.

This doesn't match /audio/foo - the "*" splat only matches one level of 
the url (it stops at "/").

get '/*' => sub {
     my ($match) = splat;
     render_markdown($match)
};

You either want: '/*/*' if you'll only ever have two levels to match or 
use the "megasplat" "/**" which will return a list. See docs for more.

-- 
   Richard Huxton
   Archonet Ltd


More information about the Dancer-users mailing list