Sha256: 810b6216763086b7ef8d70962519385de7db6a934f1c8c7c0ec182467bc65287

Contents?: true

Size: 618 Bytes

Versions: 1

Compression:

Stored size: 618 Bytes

Contents

# frozen_string_literal: true

Dial::Engine.routes.draw do
  scope path: "/dial", as: "dial" do
    get "profile", to: lambda { |env|
      uuid = env[Rack::QUERY_STRING].sub("uuid=", "")
      path = String ::Rails.root.join Dial::PROFILE_OUT_RELATIVE_DIRNAME, "#{uuid}.json"

      if File.exist? path
        [
          200,
          { "Content-Type" => "application/json", "Access-Control-Allow-Origin" => "https://vernier.prof" },
          [File.read(path)]
        ]
      else
        [
          404,
          { "Content-Type" => "text/plain" },
          ["Not Found"]
        ]
      end
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dial-0.1.2 lib/dial/engine/routes.rb