REST
I keep hearing about REST and RESTful stuff in Rails, but I don’t really understand. Is it about serving different types of content (HTML, RSS, XML) depending on the device that’s requesting the data?
Trackbacks
Use this link to trackback from your own site.
No, it’s about using the web protocols correctly. For years, people pretended that HTTP is just a way to make Remote Procedure Calls. For example:
http://example.com/cgi_program.pl?id=3334&dir=foo&cmd=bar
This has a lot of problems:
Instead, it’s better to put your “resources” (documents, people, whatever) at the center. This isn’t any more difficult to write (at most, one extra config line in your web server, but usually not even that.)
http://example.com/doc/foo/3334
If you follow REST, this means:
That’s just scratching the surface. There’s a lot more to it. It’s one of those “things get simpler if you give yourself some limitations”. For example, it might be useful to have a 10ft wide car, but the problems driving down the road would outweigh the benefits.