Rack provides an interface so that you don't have to deal with some elements of the server. Such as listening on a port, accepting connections, parsing HTTP responses and requests.
This gives you more time to spend on writing what the application does and providing value.
Protocol
Rack protocol is simply a Ruby object with a call method, being a proc it has a "call" method. The method arguments are the environment variables which describe the incoming request. The return value is an array with [status, headers, body].
status: The HTTP status code
headers: hash of HTTP headers for the response
body: Body of the response.
A simple HelloWorld app in Rack
#config.ru classHelloWorld defself.call(env) [200, {"Content-Type";=>"text/plain"}, ["Hello World!"] end end
Entering 'rackup' in the terminal will start our rack up
Accessing the up and running website by going to "localhost:9292"