We have a simple API plan, it does the standard web request/handle flow:
get requests from users, do something with DB queries, return the
results to users.
I know well about CGI and ruby’s CGI module. So it’s quiet easy to write
the API with CGI module with Apache as webserver.
But, does CGI have slow performance? What’s the good alternative?
Sorry I know nothing about Rais, and I don’t think we need rails to run
for this simple service.
CGI module is fairly crap. (Slow performance, has to load a Ruby
interpreter against every request, etc.) If you have a simple API, it’s
probably better to choose something much more lightweight and not Ruby,
depending on how complex it is.
We have a simple API plan, it does the standard web request/handle
flow: get requests from users, do something with DB queries, return
the results to users.
I know well about CGI and ruby’s CGI module. So it’s quiet easy to
write the API with CGI module with Apache as webserver. But, does
CGI have slow performance? What’s the good alternative?
What do you need as performance? Lots of hits per second? Because, for
simple in-house use, with a few people making queries now and then,
Webrick does an excellent job. Webrick is the web server included in
the official Ruby code. Sadly, you won’t find much documentation
around, but once you have overcome the initial learning step, things
go quite smooth - all you have to run is your Ruby process.
Then, Ruby has a VERY VAST offer of solutions for web coding, even for
high-throughput sites. But it’s a world that requires quite a long
learning process. You may want to read about Rack: