Created
May 8, 2018 08:25
-
-
Save neidiom/cb7506f604c314676703bf982994204a to your computer and use it in GitHub Desktop.
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
require 'sinatra' | |
set :bind, '0.0.0.0' | |
set :port, 8080 | |
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