Home

Awesome

net-http-server

Description

{Net::HTTP::Server} is a pure Ruby HTTP server.

Features

Examples

Simple HTTP Server:

require 'net/http/server'
require 'pp'

Net::HTTP::Server.run(:port => 8080) do |request,stream|
  pp request

  [200, {'Content-Type' => 'text/html'}, ['Hello World']]
end

Use it with Rack:

require 'rack/handler/http'

Rack::Handler::HTTP.run app

Using it with rackup:

$ rackup -s HTTP

Requirements

Install

$ gem install net-http-server

Copyright

Copyright (c) 2011-2022 Hal Brodigan

See {file:LICENSE.txt} for details.