it will create a hash called env • A Rack application is any ruby object that can respond to the call method, it can be a lambda, or an instance of a class that defines a call method. ! • rackup
some code in the pipeline to modify either the request or the response • A middleware is just like a Rack app, except that you construct it with another Rack application.
one we just saw • config.ru ! ! • Rails.application is an attribute accessor defined in railties/lib/rails.rb • config/environment.rb will Initialize your rails application with
Each middleware is instantiated with the one that follows him in the stack. • The last middleware is instantiated with the actual rack app. • Invoking call on this object will go through all the middlewares and the app.
instance of Journey::Router • we are inside the Journey engine, the rails router. • Its job is to find the correct route defined in config/routes.rb for the incoming request. • The router will choose the appropriate controller and action for this request, and place in the Rack env a hash containing them.
a controller from them. params[:controller] • If the controller is not found, Rails will return an empty response with the HTTP status code 404. • X-Cascade • dispatch(controller, params[:action], env)