Hacker News new | ask | show | jobs
by mikek85 5858 days ago
The main argument is flexibility and acknowledging what the role of the controller actually is in a resource-oriented application

Idea 2 is the way to go because it's resource oriented and you get useful stuff like 405's for free which you don't with the sinatra approach.

Please don't remove routing. Having routes is important - it makes the code more descriptive and easier to follow. All a route needs to do is map one URI pattern to one controller, i.e:

/blog -> BlogController

/blog/:post -> BlogPostController

/blog/:post/comments -> BlogPostCommentsController

I wrote a hack for Zend Framework last year to prove how this would work:

http://restafari.blogspot.com/2010/04/restful-php-applicatio...