Skip to content

Instantly share code, notes, and snippets.

@nilcolor
Created August 13, 2015 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nilcolor/21ead88d1517e824f103 to your computer and use it in GitHub Desktop.
Save nilcolor/21ead88d1517e824f103 to your computer and use it in GitHub Desktop.
Lotus sample
$ curl -H "Content-Type: application/json" -X POST -d '{"foo":"bar"}' http://localhost:2300/catch
OK
$
# apps/web/controllers/catch/incoming.rb
module Web::Controllers::Catch
class Incoming
include Web::Action
accept :json
def call(params)
puts "Got: #{params[:foo]}" # => nil here
self.status = 200
self.body = "OK"
end
end
end
# apps/web/config/routes.rb
post "/catch", to: "catch#incoming"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment