Skip to content

Instantly share code, notes, and snippets.

@lfv89
Last active October 13, 2018 16:22
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 lfv89/390fac01073d17f553f51981f381abb1 to your computer and use it in GitHub Desktop.
Save lfv89/390fac01073d17f553f51981f381abb1 to your computer and use it in GitHub Desktop.
hello world with mongrel
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'mongrel', '1.2.0.pre2'
end
class BasicHttpHandler < Mongrel::HttpHandler
def process(request, response)
response.start(200) do |head, output|
head["Content-Type"] = "text/plain"
output.write("Hello, World!")
end
end
end
mongrel = Mongrel::HttpServer.new("0.0.0.0", "3000")
mongrel.register("/", BasicHttpHandler.new).run.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment