This article explores the interaction between four different Ruby web servers and their respective Rack handlers. The servers being the famous Webrick, Mongrel, Thin and Puma.
The idea is to use these servers to
Hello, World! at
/, both on and off Rack. The goal is to make it clearer why Rack was created in the first place, and why to this day it’s still so relevant.
The examples to come will help to illustrate the role that Rack, specially the
Rack::Handler, plays on being that minimal interface between Ruby web servers and Ruby web frameworks, as stated…
Please note that some of these will come from Ruby itself, and thus won’t be necessarily restricted to the console.
It is possible to run the console in a mode called
sandbox. In that mode, every change made to the database will be automatically rolled back when the session terminates:
$ rails console --sandbox
The result of the immediately previous console execution can be retrieved and, as the example suggests, assigned to a local variable by calling the
=> ["zelda", "mario", "gta"]>> names = _
=> ["zelda", "mario", "gta"]
It is possible to find out the…