Class: Jets::Middleware::DefaultStack
- Inherits:
-
Object
- Object
- Jets::Middleware::DefaultStack
- Defined in:
- lib/jets/middleware/default_stack.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #build_stack ⇒ Object
-
#initialize(app, config) ⇒ DefaultStack
constructor
A new instance of DefaultStack.
Constructor Details
#initialize(app, config) ⇒ DefaultStack
Returns a new instance of DefaultStack.
6 7 8 9 |
# File 'lib/jets/middleware/default_stack.rb', line 6 def initialize(app, config) @app = app @config = config end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
5 6 7 |
# File 'lib/jets/middleware/default_stack.rb', line 5 def app @app end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/jets/middleware/default_stack.rb', line 5 def config @config end |
Instance Method Details
#build_stack ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/jets/middleware/default_stack.rb', line 11 def build_stack Stack.new do |middleware| middleware.use Shotgun::Static middleware.use Rack::Runtime middleware.use Jets::Controller::Middleware::Cors if cors_enabled? middleware.use Rack::MethodOverride unless ENV['JETS_RACK_METHOD_OVERRIDE'] == '0' # must come before Middleware::Local for multipart post forms to work middleware.use Jets::Controller::Middleware::Reloader if Jets.config.hot_reload middleware.use Jets::Controller::Middleware::Local # mimics AWS Lambda for local server only middleware.use session_store, middleware.use Rack::Head middleware.use Rack::ConditionalGet middleware.use Rack::ETag use_webpacker(middleware) end end |