diff --git a/frameworks/Ruby/hanami/app/actions/json/index.rb b/frameworks/Ruby/hanami/app/actions/json/index.rb deleted file mode 100644 index 9dd7220a45c..00000000000 --- a/frameworks/Ruby/hanami/app/actions/json/index.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module HelloWorld - module Actions - module JSON - class Index < HelloWorld::Action - def handle(*, response) - response.format = :json - response.body = { 'message' => 'Hello, World!' }.to_json - end - end - end - end -end diff --git a/frameworks/Ruby/hanami/app/actions/plaintext/index.rb b/frameworks/Ruby/hanami/app/actions/plaintext/index.rb deleted file mode 100644 index dee41365b02..00000000000 --- a/frameworks/Ruby/hanami/app/actions/plaintext/index.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module HelloWorld - module Actions - module Plaintext - class Index < HelloWorld::Action - def handle(*, response) - response.body = 'Hello, World!' - end - end - end - end -end diff --git a/frameworks/Ruby/hanami/config/routes.rb b/frameworks/Ruby/hanami/config/routes.rb index 55f2f414845..b57e5af753f 100644 --- a/frameworks/Ruby/hanami/config/routes.rb +++ b/frameworks/Ruby/hanami/config/routes.rb @@ -2,11 +2,27 @@ module HelloWorld class Routes < Hanami::Routes - get "/json", to: "json.index" + get "/json", to: ->(env) do + [200, + { + 'Server' => 'Rails', + 'Content-Type' => 'application/json', + 'Date' => Time.now.httpdate, + }, + [{ 'message' => 'Hello, World!' }.to_json]] + end get "/db", to: "db.index" get "/queries", to: "queries.index" get "/fortunes", to: "fortunes.index" get "/updates", to: "updates.index" - get "/plaintext", to: "plaintext.index" + get "/plaintext", to: ->(env) do + [200, + { + 'Server' => 'Hanami', + 'Content-Type' => 'text/plain', + 'Date' => Time.now.httpdate + }, + ['Hello, World!']] + end end end