Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby framework to write a API in? [closed]

Hi I'm looking to write a multiplatorm tasks application for technical people. I want to handle as many platforms as I can (web, shell, desktop) and therefore I have decided to begin with a server/API.

I want to write it in Ruby, however i think that Rails is a bit too heavy for this, even though it would do the job. Sinatra also doesn't seem quite suited for the task.

All the server/API would do would be to translate simple requests to Database queries, and at a later stage some authentication and authorization.

So basically I want to know:

1) Should I use a REST api or a SOAP api?

2) Is there a framework for this? Or what is the closest framework avalable?

like image 211
thomasfedb Avatar asked Jun 20 '10 16:06

thomasfedb


3 Answers

For the adventurous, there is also a less known project called grape. It is a rack based application, similar to Sinatra, but is only purposed to write API. I don't think it is mature enough to be used in serious projects yet, but it is still interesting to know.

like image 150
Aaron Qian Avatar answered Oct 12 '22 15:10

Aaron Qian


1) REST, SOAP is a terrible system and its support in Ruby is quite lacking. REST, on the other hand, is basically the ruby default and takes very little effort to use, especially if you are using REST/JSON.

2) Sinatra and Rails are basically your options. It comes down to how complex this application will be. Sinatra can probably handle the task just fine, but Rails does much of the work for you at the expense of bloat. You will already be taking on some of the rails bloat if you use ActiveRecord for the database. When authentication and/or roles come into play, Rails has mature solutions for both. Without any additional information, I'd lean towards Rails as it does much of the work for you and, when written properly, can still be fairly fast.

like image 32
Ben Hughes Avatar answered Oct 12 '22 16:10

Ben Hughes


Actually SOAP is very VERY easy to implement with AWS. At the same time, REST API is also very easy to implement. I have written a couple of different and parallel (JSON, XML and custom format) APIs with rails. Im sure the framework stack performance will not be your bottleneck, so don't bother with worrying about performance just yet. Your first bottleneck will anyhow be database and then perhaps requests per second.

All in all i would suggest going with Rails, it has a lot of work cut out for you.

like image 1
Tanel Suurhans Avatar answered Oct 12 '22 17:10

Tanel Suurhans