Skip to content

Instantly share code, notes, and snippets.

@whalesalad
Created December 14, 2018 19:43
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 whalesalad/369b7a85edf6c2d125d4da64fec8b4eb to your computer and use it in GitHub Desktop.
Save whalesalad/369b7a85edf6c2d125d4da64fec8b4eb to your computer and use it in GitHub Desktop.
require "json"
require "http/server"
server = HTTP::Server.new do |context|
environment = Hash.zip(ENV.keys, ENV.values)
context.response.content_type = "application/json"
context.response.print environment.to_json
end
address = server.bind_tcp(ENV["PORT"].to_i || 8080)
puts "Listening on http://#{address}"
server.listen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment