[Melbourne-pm] Dancer: index.html

Scott Penrose scottp at dd.com.au
Thu Jun 6 22:30:13 PDT 2013

FYI - worked around my problem with a couple of hooks.

get '/X/' => sub {
	send_file "/X/index.html";

get qr{^/X/(.+)/$} => sub {
	my ($name) = splat;
	send_file "/X/$name/index.html";

On 07/06/2013, at 11:54 AM, Scott Penrose wrote:

> Hi Perl Mongers
> Anyone familiar with Dancer and public files?
> In production, my public files are delivered by Apache, which means I can go to /fred/ and get actually /fred/index.html. But when I run in Dancer and go to /fred/ I have to specifically enter /fred/index.html.
> I can easily add a rule for each of my directories, but that is a bit of a pain.
> Is there any way to add configuration so public (static) content automatically looks for index.html?
> Ta
> Scott
> P.S. If not, I guess it could be done with an even on the 404. ie if 404, try adding index.html to the end and retry.
> _______________________________________________
> Melbourne-pm mailing list
> Melbourne-pm at pm.org
> http://mail.pm.org/mailman/listinfo/melbourne-pm

More information about the Melbourne-pm mailing list