Class: Jets::Middleware::DefaultStack

Inherits:
Object
  • Object
show all
Defined in:
lib/jets/middleware/default_stack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, config) ⇒ DefaultStack

Returns a new instance of DefaultStack.



4
5
6
7
# File 'lib/jets/middleware/default_stack.rb', line 4

def initialize(app, config)
  @app = app
  @config = config
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



3
4
5
# File 'lib/jets/middleware/default_stack.rb', line 3

def app
  @app
end

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/jets/middleware/default_stack.rb', line 3

def config
  @config
end

Instance Method Details

#build_stackObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/jets/middleware/default_stack.rb', line 9

def build_stack
  Stack.new do |middleware|
    middleware.use Rack::Runtime
    middleware.use Rack::MethodOverride # must come before Middleware::Local for multipart post forms to work
    middleware.use Jets::Controller::Middleware::Local # mimics AWS Lambda for local server only
    middleware.use session_store, session_options # use session_store, session_options
    middleware.use Rack::Head
    middleware.use Rack::ConditionalGet
    middleware.use Rack::ETag
    use_webpacker(middleware)
  end
end