Created
August 13, 2015 21:59
-
-
Save nilcolor/21ead88d1517e824f103 to your computer and use it in GitHub Desktop.
Lotus sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -H "Content-Type: application/json" -X POST -d '{"foo":"bar"}' http://localhost:2300/catch | |
OK | |
$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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