Skip to content

Instantly share code, notes, and snippets.

@Willamin
Created January 25, 2018 19:28
Show Gist options
  • Save Willamin/8854c9e0998641260952e9bdf00de5d9 to your computer and use it in GitHub Desktop.
Save Willamin/8854c9e0998641260952e9bdf00de5d9 to your computer and use it in GitHub Desktop.
require "http/server"
class MyRoutingHandler
include HTTP::Handler
def call(context)
case context.request.path
when "/", "/home"
context.response << "hello"
end
end
end
puts "listening"
HTTP::Server.new("127.0.0.1", 1234, [
MyRoutingHandler.new,
]).listen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment