class
Fossil::Server
- Fossil::Server
- Reference
- Object
Overview
Wrapper around HTTP::Server
that holds the root Fossil::Router
for the app.
Defined in:
server.crConstructors
Instance Method Summary
-
#bind(uri : String) : Socket::Address
Binds an inner
HTTP::Server
touri
. -
#bind(uri : URI) : Socket::Address
Binds an inner
HTTP::Server
touri
. -
#close : Nil
Gracefully terminates the server.
- #http_server : HTTP::Server
-
#listen(port : Int32, reuse_port : Bool = false)
Creates a
TCPServer
listening on127.0.0.1:port
, adds it as a socket and starts the server. -
#listen(host : String, port : Int32, reuse_port : Bool = false)
Creates a
TCPServer
listening onhost:port
, adds it as a socket and starts the server. -
#listen : Nil
Starts the server.
- #root : Fossil::Router
Constructor Detail
def self.new(*, root_path : String = "", handlers : Indexable(HTTP::Handler) = [] of HTTP::Handler)
#
Instance Method Detail
def close : Nil
#
Gracefully terminates the server. It will process currently accepted requests, but it won't accept new connections.
def listen(port : Int32, reuse_port : Bool = false)
#
Creates a TCPServer
listening on 127.0.0.1:port
, adds it as a socket
and starts the server. Blocks until the server is closed.
def listen(host : String, port : Int32, reuse_port : Bool = false)
#
Creates a TCPServer
listening on host:port
, adds it as a socket
and starts the server. Blocks until the server is closed.