G'day, On Sat, Apr 27, 2013 at 10:32:20PM -0700, Mark Wood-Patrick wrote: >I need to display index.html for any subdirectory where that file >exists not just the root
I suspect you probably want to look at the way that `auto_page` is
implemented, although you may need to appropriate and modify it: in D1,
it's render_autopage and _autopage_response in `Dancer::Renderer`, and
in D2, it's in `Dancer2::Handler::AutoPage`.
I can't really think of any other ways to do it off-hand, other than
with a catch-all route, but that would fall over, I suspect, if you
needed a route at `/todomvc/architecture-examples/yui` as well as at
`/todomvc/architecture-examples/yui/index.html`. A route something like
get qr{(.*)} => sub {
my ($path) = splat;
return redirect $path."/index.html"
if -e settings('views_dir').$path."/index.html";
return send_error(404);
};
-- assuming a setting, `views_dir`, pointing at your views directory;
alternately, `setting('appdir')."/views"` should work, given a fairly
standard setup -- should work.
Jashank
--
Jashank Jeremy
WWW rulingia.com/~jashank
PGP D05D79F1 41DA2FB5 233E0565 ACC5E467 25A5C309
pgp5KJJWofes0.pgp
Description: PGP signature
_______________________________________________ dancer-users mailing list [email protected] http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
