Sha256: 4d28487be1d08989e441cfb877199d3c6cde446250984b6414f3987c0ec7a8a0
Contents?: true
Size: 830 Bytes
Versions: 5
Compression:
Stored size: 830 Bytes
Contents
#!/usr/bin/env ruby $:<< '../lib' << 'lib' require 'goliath' class RawFileApp < Goliath::API use Goliath::Rack::Params # parse & merge query and body parameters use Goliath::Rack::DefaultMimeType # cleanup accepted media types use Goliath::Rack::Formatters::JSON # JSON output formatter use Goliath::Rack::Render # auto-negotiate response format def response(env) p params p params['key2'] p params[:key2] obj = { somekey: 'val', otherkey: 42 } [200, { 'Content-Type' => 'application/json' }, obj] end end class Router < Goliath::API get '/v1/app/:appid/binary/:key', RawFileApp put '/v1/app/:appid/binary/:key', RawFileApp not_found do run Proc.new { |env| [404, {"Content-Type" => "text/html"}, "not found"] } end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
goliath-1.0.4 | examples/test.rb |
goliath-1.0.2 | examples/test.rb |
goliath-1.0.1 | examples/test.rb |
goliath-1.0.0 | examples/test.rb |
goliath-1.0.0.beta.1 | examples/test.rb |