Sha256: 0dd025e8ba15891bfd48752a6a1c8999848c2f3fa919a85a9de0c0ce3e1550aa

Contents?: true

Size: 464 Bytes

Versions: 13

Compression:

Stored size: 464 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'tipi'
require 'fileutils'

opts = {
  reuse_addr:  true,
  dont_linger: true
}

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

root_path = FileUtils.pwd

trap('INT') { exit! }

Tipi.serve('0.0.0.0', 4411, opts) do |req|
  path = File.join(root_path, req.path)
  if File.file?(path)
    req.serve_file(path)
  else
    req.respond(nil, ':status' => Qeweney::Status::NOT_FOUND)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
tipi-0.55 examples/http_server_static.rb
tipi-0.54 examples/http_server_static.rb
tipi-0.53 examples/http_server_static.rb
tipi-0.52 examples/http_server_static.rb
tipi-0.51 examples/http_server_static.rb
tipi-0.50 examples/http_server_static.rb
tipi-0.49 examples/http_server_static.rb
tipi-0.47 examples/http_server_static.rb
tipi-0.46 examples/http_server_static.rb
tipi-0.45 examples/http_server_static.rb
tipi-0.43 examples/http_server_static.rb
tipi-0.42 examples/http_server_static.rb
tipi-0.41 examples/http_server_static.rb