class

Fossil::Server

Inherits Reference < Object

Wrapper around HTTP::Server that holds the root Fossil::Router for the app.

Constructors

new(*, root_path : String = "", handlers : Indexable(HTTP::Handler) = [] of HTTP::Handler)
Source

Instance methods

bind(uri : String) : Socket::Address

Binds an inner HTTP::Server to uri.

Source
bind(uri : URI) : Socket::Address

Binds an inner HTTP::Server to uri.

Source
close

Gracefully terminates the server. It will process currently accepted requests, but it won't accept new connections.

Source
http_server
Source
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.

Source
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.

Source
listen

Starts the server. Blocks until the server is closed.

Source
root
Source