Class Rack::Server
In: lib/rack/server.rb
Parent: Object

Methods

app   default_options   middleware   middleware   new   options   server   start   start  

Classes and Modules

Class Rack::Server::Options

Attributes

options  [W] 

Public Class methods

Options may include:

  • :app
      a rack application to run (overrides :config)
    
  • :config
      a rackup configuration file path to load (.ru)
    
  • :environment
      this selects the middleware that will be wrapped around
      your application. Default options available are:
        - development: CommonLogger, ShowExceptions, and Lint
        - deployment: CommonLogger
        - none: no extra middleware
      note: when the server is a cgi server, CommonLogger is not included.
    
  • :server
      choose a specific Rack::Handler, e.g. cgi, fcgi, webrick
    
  • :daemonize
      if true, the server will daemonize itself (fork, detach, etc)
    
  • :pid
      path to write a pid file after daemonize
    
  • :Host
      the host address to bind to (used by supporting Rack::Handler)
    
  • :Port
      the port to bind to (used by supporting Rack::Handler)
    
  • :AccessLog
      webrick acess log options (or supporting Rack::Handler)
    
  • :debug
      turn on debug output ($DEBUG = true)
    
  • :warn
      turn on warnings ($-w = true)
    
  • :include
      add given paths to $LOAD_PATH
    
  • :require
      require the given libraries
    

Start a new rack server (like running rackup). This will parse ARGV and provide standard ARGV rackup options, defaulting to load ‘config.ru’.

Providing an options hash will prevent ARGV parsing and will not include any default options.

This method can be used to very easily launch a CGI application, for example:

 Rack::Server.start(
   :app => lambda do |e|
     [200, {'Content-Type' => 'text/html'}, ['hello world']]
   end,
   :server => 'cgi'
 )

Further options available here are documented on Rack::Server#initialize

Public Instance methods

[Validate]