Skip to content

Instantly share code, notes, and snippets.

@grvm
Created March 24, 2017 09:23
Show Gist options
  • Save grvm/e31ca0676aa60a86177955080a69ab5b to your computer and use it in GitHub Desktop.
Save grvm/e31ca0676aa60a86177955080a69ab5b to your computer and use it in GitHub Desktop.
HTTP Server in Crystal
require "http/server"
server = HTTP::Server.new(8080) do |context|
context.response.content_type = "text/plain"
context.response.print "Hello world at #{Time.now}"
end
puts "Listening on http://0.0.0.0:8080"
server.listen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment