Sha256: 922c342cc8ab6507a8e1251ec8ce443993315f808a47d7f647d18f20d1871ed3

Contents?: true

Size: 547 Bytes

Versions: 1

Compression:

Stored size: 547 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony/http'

opts = {
  reuse_addr: true,
  dont_linger: true
}

spin do
  Polyphony::HTTP::Server.serve('0.0.0.0', 1234, opts) do |req|
    req.respond('Hello world!')
    # req.send_headers
    # req.send_body_chunk("Method: #{req.method}\n")
    # req.send_body_chunk("Path: #{req.path}\n")
    # req.send_body_chunk("Query: #{req.query.inspect}\n", done: true)
  end
rescue Exception => e
  puts "*" * 40
  p e
end

puts "pid: #{Process.pid}"
puts "Listening on port 1234..."

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polyphony-0.19 examples/http/http_server.rb