Class: Hanami::CLI::Commands::App::Server Private

Inherits:
Hanami::CLI::Command show all
Defined in:
lib/hanami/cli/commands/app/server.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Launch Hanami web server.

It's intended to be used only on development. For production, you should use the rack handler command directly (i.e. bundle exec puma -C config/puma.rb).

The server is just a thin wrapper on top of Rack::Server. The options that it accepts fall into two different categories:

  • When not explicitly set, port and host are not passed to the rack server instance. This way, they can be configured through the configured rack handler (e.g., the puma configuration file).

  • All others are always given by the Hanami command.

Run bundle exec hanami server -h to see all the supported options.

Since:

  • 2.0.0

Instance Method Summary collapse

Methods inherited from Hanami::CLI::Command

new

Constructor Details

#initialize(server: Hanami::CLI::Server.new, **opts) ⇒ Server

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Server.

Since:

  • 2.0.0



49
50
51
52
# File 'lib/hanami/cli/commands/app/server.rb', line 49

def initialize(server: Hanami::CLI::Server.new, **opts)
  super(**opts)
  @server = server
end

Instance Method Details

#call(port: Hanami::Port::DEFAULT, **kwargs) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



56
57
58
# File 'lib/hanami/cli/commands/app/server.rb', line 56

def call(port: Hanami::Port::DEFAULT, **kwargs)
  server.call(port: Hanami::Port[port], **kwargs)
end