I want to build a Rails application that expose a RESTful web service used by a mobile application. I wanna create something maintainable and scalable, but I'm a little bit confused about best practises to achieve a good result.
First things first, API versioning. Over time my APIs will grow up and I want to keep them as smooth as possible. I've read this post: Best practices for API versioning? and I completely agree with it.
An excerpt of my routing strategy is:
/api/v1/ .. all sorts of controllers (api v1) ...
/api/v2/ .. (api v2) ..
/api/ .. controllers of the latest mainstream API
As a development strategy, I take advantage of JSON data formats, also to create new resources.
Another important aspect I'm afraid of is security: I cannot generate an authenticity token from the mobile APP, so I'm wondering how to protect the Rails API controllers. Should I use standard HTTP authentication? Are there better ways to do that?
Last but not least, I'm trying to improve overall performances: remove unnecessary rack middlewares, inherit from ActionController::Metal and get rid of ActiveResource. Should I consider some pitfalls?
Any suggestion to build such a RESTful application will be appreciated.