[typo] RESTful Typo

Piers Cawley pdcawley at bofh.org.uk
Mon Aug 21 06:54:41 EDT 2006


So, I've finally got around to reading up on the workings of the
Simply RESTful additions to Edge rails and I think I am in love.

The first time I saw Rails, not long after it was announced as it
happens, I looked at the standard URL forms and thought "Ick! That's
not very RESTful". Then when Typo came along and I started hacking, I
tended to hold my nose slightly as I contemplated the default routes.

I spy some routes.rb rejiggery in the near future. My goal is to
continue to support the following permaURLs, but they will no longer
be canonical:

   articles/:year/:month/:day/:title
   articles/:year/:month/:day

   xml/itunes/feed.xml 
   xml/articlerss/:id/feed.xml # Probably a redirect to 'articles/:id', :format => 'xml'
   xml/commentrss/feed.xml => comments/index.xml
   xml/trackbackrss/feed.xml => trackbacks/index.xml
   xml/:format/feed.xml => articles/index.xml;format
   xml/:format/:type/feed.xml => :type/index.xml;format

Etc.

The translation to RESTful URLs should be relatively
straightforward. At the moment, it looks like the biggest change would
be to the admin URLs. For instance admin/content would become
articles/index;admin (which so wouldn't be cached).

The power of RESTful URLs becomes apparent when you consider page
caching. One of the problems we had with page caching before was that
the webserver didn't take query strings into account when doing page
lookups, and that caused all sorts of headaches. Even without page
caching I think we're going to be able to neaten up the fragment
caching, which is no bad thing.

Thoughts?

-- 
Piers Cawley <pdcawley at bofh.org.uk>
http://www.bofh.org.uk/


More information about the Typo-list mailing list