biryani

Gem Version Actions Status license

biryani is an HTTP/2 server implemented using Ruby Ractor.

Installation

The gem is available at rubygems.org. You can install it the following:

$ gem install biryani

Usage

This implementation intentionally provides a minimal API and delegates application-level responsibilities to your code. Roughly, it works as follows:

require 'socket'
require 'biryani'

port = ARGV[0] || 8888
socket = TCPServer.new(port)

server = Biryani::Server.new(
  # @param _req [Biryani::HTTPRequest]
  # @param res [Biryani::HTTPResponse]
  Ractor.shareable_proc do |_req, res|
    res.status = 200
    res.content = 'Hello, world!'
  end
)
server.run(socket)
$ curl --http2-prior-knowledge http://localhost:8888
Hello, world!

License

biryani is available as open source under the terms of the MIT License.