diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2015-10-25 20:29:53 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2015-10-25 20:29:53 +0900 |
commit | f36b4f1a611856bd06ff1712e5c664c12d594f9a (patch) | |
tree | da652bb607cb6e055ec781bf0b990f2186432db1 | |
parent | 7f176b380f88494123a4a51346ade28c4da51c00 (diff) | |
download | plum-f36b4f1a611856bd06ff1712e5c664c12d594f9a.tar.gz |
update README
-rw-r--r-- | README.md | 39 |
1 files changed, 33 insertions, 6 deletions
@@ -1,16 +1,43 @@ # Plum [![Build Status](https://travis-ci.org/rhenium/plum.png?branch=master)](https://travis-ci.org/rhenium/plum) [![Code Climate](https://codeclimate.com/github/rhenium/plum/badges/gpa.svg)](https://codeclimate.com/github/rhenium/plum) [![Test Coverage](https://codeclimate.com/github/rhenium/plum/badges/coverage.svg)](https://codeclimate.com/github/rhenium/plum/coverage) -A minimal implementation of HTTP/2 server. - -## Examples -* examples/ - Minimal usage. -* [rhenium/plum-server](https://github.com/rhenium/plum-server) - A example server for https://rhe.jp and http://rhe.jp. +A minimal pure Ruby implementation of HTTP/2 library / server. ## Requirements * Ruby * Ruby 2.2 with [ALPN support patch](https://gist.github.com/rhenium/b1711edcc903e8887a51) and [ECDH support patch (r51348)](https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/51348/diff?format=diff) * or latest Ruby 2.3.0-dev * OpenSSL 1.0.2 or newer (HTTP/2 requires ALPN) -* [http-parser.rb gem](https://rubygems.org/gems/http_parser.rb) (HTTP/1.1 parser; if you use "http" URI scheme) +* Optional: + * [http-parser.rb gem](https://rubygems.org/gems/http_parser.rb) (HTTP/1.1 parser; if you use "http" URI scheme) + * [rack gem](https://rubygems.org/gems/rack) if you use Plum as Rack server. + +## Usage +### As a library +See examples in `examples/` + +### As a Rack-compatible server +Insert `require "plum/rack"` to your `config.ru` +```ruby +require "plum/rack" + +App = -> env { + [ + 200, + { "Content-Type" => "text/plain" }, + [" request: #{env["REQUEST_METHOD"]} #{env["PATH_INFO"]}"] + ] +} + +run App +``` +Then run it with: +```sh +% rackup -s plum config.ru -E production +``` +By default, Plum generates a dummy server certificate and listens `0.0.0.0:9292` in HTTPS mode. + +## Examples +* examples/ - Minimal usage. +* [rhenium/plum-server](https://github.com/rhenium/plum-server) - A example server for https://rhe.jp and http://rhe.jp. ## TODO * **Better API** |