Sha256: 1680cf756c8d1ca86fc087fda2c6c045eb1b8718a2bb4bbaf6ba356a4f6d126e

Contents?: true

Size: 744 Bytes

Versions: 2

Compression:

Stored size: 744 Bytes

Contents

class BrandSectionHandler < BaseHandler
    def mount
        @server.mount_proc("/section") do |req, res|
            begin
                query = CGI.parse(req.query_string)
                path = query['path']&.first
                if File.exist?(path)
                    res.body = File.read(path)
                    res['Content-Type'] = 'application/json'
                else
                    res.status = 404
                    res.body = JSON.generate({ error: "Config file not found: #{path}" })
                    res['Content-Type'] = 'application/json'
                end
            rescue StandardError => e
                handle_error(res, e, "Error in brand section handler")
            end
        end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solara-0.2.0 solara/lib/core/dashboard/handler/brand_section_handler.rb
solara-0.1.0 solara/lib/core/dashboard/handler/brand_section_handler.rb