On Jul 10, 2016, at 11:20 AM, James E Keenan <[email protected]> wrote:
>
> All the endpoints defined in lib/mywebapp.pm continue to function as
> expected. But the endpoint, /api/userdata/:user, defined in
> lib/mywebapp/api.pm, no longer works.
That’s because your “mount” for the api.pm routes prepends ‘/api’ to them.
When you use the module standalone as you’re attempting to now, that bit is
stripped off. You’ll find that you now have /userdata/$stuff now.
Easy fix: wrap the route definitions in api.pm in a prefix block:
prefix '/api' => sub {
any ['get', 'post'] => '/userdata/:user' => sub {
# etc
};
};
You could even extract the other layer, too:
prefix '/api' => sub {
prefix '/userdata' => sub {
any ['get', 'post'] => ':user' => sub {
# etc
};
};
};
_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users