class Fossil::Server

Overview

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

Defined in:

server.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(*, root_path : String = "", handlers : Indexable(HTTP::Handler) = [] of HTTP::Handler) #

Instance Method Detail

def bind(uri : String) : Socket::Address #

Binds an inner HTTP::Server to uri.


def bind(uri : URI) : Socket::Address #

Binds an inner HTTP::Server to uri.


def close : Nil #

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


def http_server : HTTP::Server #

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.


def listen : Nil #

Starts the server. Blocks until the server is closed.


def root : Fossil::Router #