require "json" get "/info" do |env| version = APP["version"] if env.params.query["json"]? env.response.content_type = "application/json" data = {version: version}.to_json data else env.response.content_type = "text/plain" "Vesrion: #{version}" end end