Sha256: 1dea26e2e1d0defde12a908d58c6645541008d2ae55211d8749470cd0fda6c8b
Contents?: true
Size: 927 Bytes
Versions: 13
Compression:
Stored size: 927 Bytes
Contents
require "rack/mime" # 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. class Jets::PublicController < Jets::Controller::Base layout false internal true # # Use python until ruby support is added. # python :show if Jets::Commands::Build.poly_only? # Use python if poly only so we don't have to upload rubuy python :show else # TODO: When ruby support is relesed, switch to it only. 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 end end
Version data entries
13 entries across 13 versions & 1 rubygems