Class: Jets::PublicController
- Inherits:
-
Controller::Base
- Object
- Lambda::Functions
- Controller::Base
- Jets::PublicController
- Defined in:
- lib/jets/internal/app/controllers/jets/public_controller.rb
Overview
Works for utf8 text files. TODO: Add support to public_controller for binary data like images. Tricky because API Gateway is not respecting the Accept header the same way as browsers.
Instance Attribute Summary
Attributes inherited from Controller::Base
Attributes inherited from Lambda::Functions
Instance Method Summary collapse
-
#show ⇒ Object
TODO: When ruby support is relesed, switch to it only.
Methods inherited from Controller::Base
#initialize, internal, process
Methods included from Controller::Params
Methods included from Controller::Rendering
#actual_host, #add_stage_name, #adjust_content_type!, #default_layout, #default_options, #ensure_render, #normalize_options, #render, #url_for
Methods included from Controller::Redirection
#ensure_protocol, #redirect_to
Methods inherited from Lambda::Functions
Methods included from Lambda::Dsl
Constructor Details
This class inherits a constructor from Jets::Controller::Base
Instance Method Details
#show ⇒ Object
TODO: When ruby support is relesed, switch to it only.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jets/internal/app/controllers/jets/public_controller.rb', line 18 def show public_path = Jets.root + "public" catchall_path = "#{public_path}/#{params[:catchall]}" if File.exist?(catchall_path) content_type = Rack::Mime.mime_type(File.extname(catchall_path)) render file: catchall_path, content_type: content_type else render file: "#{public_path}/404", status: 404 end end |