Or is Rails by itself just good for developing APIs?
It seems that ASP.NET Web API project types have some history intertwined with WCF (as is detailed in this post for example), so maybe it’s not applicable to Rails.
UPDATE
To clarify, Microsoft has the ASP.NET MVC framework. Recently, they came out with a framework called ASP.NET Web API. ASP.NET Web API seems to have similarities to ASP.NET MVC, but is specialized and trimmed down for RESTful web services. Is there an equivalent in the Ruby/Rails space?
So, the answer is Yes to both questions.
Railsdoes have an equivalent and itsRails.ASP.NET Web APIlooks like at it’s heart is just a RESTful router with type negotiation. I could be totally off base here, but from the tutorials I saw that’s what it looked like to me.So yes, from what I can tell, Rails supports most of the things that the
Web APIwas created for. In fact in Rails most of this stuff is forced onto you until you become informed enough to be able to change it (assuming by that point you know better than to actually do that).But, as far as
Web APIfunctionality. That really comes from the ability to support HTTP verbs (GET,POST,PUT,DELETE) whichRailsdoes.But a source of confusion might be that in
Railsthe RESTful API is actually the application itself. Meaning you don’t need to implement any other libraries, it’s just built that way.Here’s a quick example of that I mean
When you hit
/users/1you will get the data associated with that user depending on the format you requested. So if you request JSON the controller returns JSON, HTML you get HTML, XML you get XML, etc. (As long as said format is implemented for that resource)A good overview of what I’m talking about are in these two sections:
Rails Guides::Controller: Rendering xml and json data
Rails Guides::Routing: Resources on the Web
So you could build a website, API, or both in a Rails app and they would all start the same way.
But from my limited knowledge on the matter, I would say a
ASP.NET MVC with ASP.NET Web APIprogram is actually a lot more like aRails Programthan the regularASP.NET MVCprograms that came before them.Or it’s all just a clever ploy to get as many Capital Letters in a title as humanly possible.