Skip to content

Instantly share code, notes, and snippets.

@brandonmwest
Last active Aug 29, 2015
Embed
What would you like to do?
Log a JSON payload in Sinatra
post '/event' do
status 204 #successful request with no body content
request.body.rewind
request_payload = JSON.parse(request.body.read)
#append the payload to a file
File.open("events.txt", "a") do |f|
f.puts(request_payload)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment