Please do not do this without a frame. There are several super-light ones, such as Sinatra , that do as little as possible to provide you with the support you need to get it right. CGI died in the 1990s and does not need to be returned.
To write a Sinatra application, you basically define a method and then deploy it to your server. Of course, you can grumble about how much work is available, but if you do not have the correct deployment procedure, you have problems before you even begin.
Ruby has a lot of infrastructure built around things like Rack that connect to Apache through modules like Passenger , which do much more than cgi-bin ever did without all the risks involved.
A typical Sinatra application looks like this:
get '/example/:id' do "Example #{params[:id]}!" end
Nothing really happens there, and the result is a lot less work than the old CGI method.
source share