[dancer-users] Recommendation for REST API

Pedro Melo melo at simplicidade.org
Tue Oct 13 12:03:10 BST 2015


Hi,

On Tue, Oct 13, 2015 at 11:37 AM, Nuno Carvalho <smash at cpan.org> wrote:

> On Mon, Oct 12, 2015 at 8:16 PM, Pedro Melo <melo at simplicidade.org> wrote:
> >
> > need to build a REST API with Dancer2. Any recommendations on what
> plugins,
> > if any, to use?
> >
> > I see Dancer2::Plugin::REST, is that the recommended one? It looks good…
> any
> > experiences with it?
>
>  I always end up doing serialization "myself", instead of relying in
> plugins. Because many times there will be some edge cases that using
> the plugin will require a huge workaround. While handling the
> serialization yourself it's always easier to adapt. And even so I
> usually end up with very simple and clean applications like:
>
> sub '/users' => sub {
>   to_json MyModel->users;
> };
>
>  If you prefer you can also use the "set serializer" option, to omit
> the to_json parts, or if you intend to have more than one serializer
> possible
>

Yeah… I have a base class for all my models so I'll probably take that
route.

Thank you all,
-- 
Pedro Melo
@pedromelo
http://www.simplicidade.org/
xmpp:melo at simplicidade.org
mailto:melo at simplicidade.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20151013/7c90d717/attachment.html>


More information about the dancer-users mailing list