Sha256: f2fe9c62ae5e568898a3dfe2fb445a10be76dd2be7a67acc109ed75af906814f

Contents?: true

Size: 446 Bytes

Versions: 2

Compression:

Stored size: 446 Bytes

Contents

# frozen_string_literal: true

class Async::App::WebServer
  include Async::Logger

  def initialize(metrics_prefix:, port: 8080)
    @router = Async::App::WebServer::Router.new(
      MetricsApp.new(metrics_prefix:),
      HealthApp.new
    )
    @endpoint = Async::HTTP::Endpoint.parse("http://0.0.0.0:#{port}")
  end

  def run
    Async { Async::HTTP::Server.new(@router, @endpoint).run }
    info { "Started on #{@endpoint.url}" }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
async-tools-0.2.9 lib/async/app/web_server.rb
async-tools-0.2.8 lib/async/app/web_server.rb