I have a Rails 3.1 application for which I want to create an API. I want my urls to look something like this:
www.example.com/controller/action // Normal Web requests api.example.com/controller/action.json // API requests
The first will be for regular requests, and the other, obviously, for my API material. I would like both to map to the same controller / action.
How to configure my application so that it only responds to HTML, when to www and json, xml, etc., when I am in the api subdomain?
source share