Last active
April 21, 2025 06:08
-
-
Save jeffjohnson9046/673c864a88e15bde6b72 to your computer and use it in GitHub Desktop.
A simple sinatra server that accepts a POST with JSON content.
This file contains hidden or 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
# To make this server publicly available on the inter-webs while running from localhost, use ngrok, which can be found here: | |
# https://ngrok.com/download. Follow the installation instructions for ngrok and start it up: | |
# | |
# ./ngrok 4567 # (or whatever port you want to listen on). | |
# | |
# ngrok will spit out an ugly but unique URL. After ngrok starts up, you should be able to POST to the sinatra server: | |
# | |
# http://6eee766f.ngrok.com/payload | |
require 'sinatra' | |
require 'json' | |
post '/payload' do | |
push = JSON.parse(request.body.read) | |
puts "I got some JSON: #{push.inspect}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome, thank you for flattening the learning curve a little bit.