[dancer-users] Recommendation for REST API

Nuno Carvalho smash at cpan.org
Tue Oct 13 11:37:08 BST 2015


Hello,

On Mon, Oct 12, 2015 at 8:16 PM, Pedro Melo <melo at simplicidade.org> wrote:
> Hi,
>
> 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

> Thanks in advance,

Best regards

> --
> Pedro Melo
> @pedromelo
> http://www.simplicidade.org/
> xmpp:melo at simplicidade.org
> mailto:melo at simplicidade.org
>
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>


More information about the dancer-users mailing list