[Catalyst] Re: Catalyst::Action::REST
Robert 'phaylon' Sedlacek
rs at 474.at
Mon Nov 20 15:25:04 GMT 2006
A. Pagaltzis said:
>
> Catalyst as it stands somewhat encourages a confusion between
> nouns (URIs) and verbs (methods), with URIs like
> `/entry/1234/comments/add`, where the `/entry/1234/comments` part
> identifies a resource, but the `/add` bit at the end is really an
> verb. That should simply be a POST to `/entry/1234/comments`. And
> most of the time, if the design is RESTful from the start, you
> can implement a web app as pure CRUD using the HTTP methods; eg.
> the methods in a controller should simply correspond 1:1 to HTTP
> verbs. That was as far as I had gotten my own thoughts.
That works with the comment example, yes. But mostly I have stuff like
/user - list of users (does GET and maybe HEAD)
/user/add - interface to add users (does GET and POST)
/user/123 - show user
/user/123/edit - interface to edit user (does GET and POST)
> What I don't like about the current proposals in Catalyst-land
> is that they make the RESTful approach a wordy non-default
> option. It takes quite a bit of extra annotation with any of
> them, even if each annotation is concise. It ends easier to just
> put verbs in your URIs, where it should be just as easy to do it
> properly.
That's why the docs on :Method aren't even speaking about REST:
"C<Method> is another action modifier. It restricts this action
to only match for requests with the specified method."
-- <http://dev.catalyst.perl.org/changeset/5551>
Although it might be a good idea to add an explicit note about this and
point the user to CPAN or a InventedWheels page on the wiki.
gr.,
Robert
--
# Robert 'phaylon' Sedlacek
# Perl 5/Catalyst Developer in Hamburg, Germany
{ EMail => ' rs at 474.at ', Web => ' http://474.at ' }
More information about the Catalyst
mailing list