Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:09
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
HTTP Server that will print the JSON arriving from a client.
Simple server which just formats and prints JSON requests.
# Run this with
# rackup -s thin
# or if you are using bundler
# bundle exec rackup -s thin
# starts on port 9292
require 'json'
require 'awesome_print'
run lambda { |env|
request =
if request.media_type == "application/json" and (body =
ap JSON.parse(body), { indent: 2 }
[200, {"Content-Type" => "application/json"}, []]
# Kick off with
# bundle install
# to install the gems.
# Uses the thin webserver and awesome_print, which will format
# the output
source ''
gem 'thin'
gem 'awesome_print'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment