backend · medium

Rack

Minimal Ruby web interface: an app is a callable that takes an env hash and returns `[status, headers, body]`.

Where you see it

Rails, Sinatra, and middleware all speak Rack. Middleware is a Rack app that calls the next app — logging, sessions, static files. Think Express middleware, but as a Ruby protocol.

Why it matters

Debugging “where did this header come from?” starts at Rack. Interviews sometimes ask you to sketch a tiny Rack app to prove you know the request cycle under Rails.

Tags: rails, ruby