Skip to content

Instantly share code, notes, and snippets.

@neidiom
Created May 8, 2018 08:25
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 neidiom/cb7506f604c314676703bf982994204a to your computer and use it in GitHub Desktop.
Save neidiom/cb7506f604c314676703bf982994204a to your computer and use it in GitHub Desktop.
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