diff --git a/app.rb b/app.rb index c0fb7b0..3935d80 100644 --- a/app.rb +++ b/app.rb @@ -209,6 +209,16 @@ before do request.session_options[:skip] = !request.path_info.start_with?("/session") end +helpers do + def json(obj, opts: nil, pretty: false) + if pretty + JSON.pretty_generate obj, opts: + else + JSON.generate(obj, opts:) + end + end +end + get "/" do "hello there!\n" end