class
Silver::App
- Silver::App
- Reference
- Object
Overview
The control-point of the application. Includes caching and server-run mechanisms.
Defined in:
silver.crInstance Method Summary
-
#add_route(method : Method, path : String, &block : Handler)
Add some route to the route list
- #connection_handler(client : TCPSocket)
- #create_error_400 : HttpResponse
- #create_error_404 : HttpResponse
-
#create_request(reader : TCPSocket) : Tuple(HttpRequest | Nil, Bool)
Create some request Returns a tuple of the request itself and the status of keep-alive as bool
-
#create_response(req : HttpRequest) : Tuple(HttpResponse, File | Nil)
Create a response corresponding to a HTTP request.
- #empty_response : HttpResponse
-
#find_handler(req : HttpRequest) : Tuple(Handler, Hash(String, String)) | Nil
Find a handler given a request, accounting for path parameters
- #html(method : Method, path : String, &block : Context -> String)
- #json(method : Method, path : String, &block : Context -> String)
- #routes : Array(Tuple(Method, Route, Handler))
- #run(port : Int, address : String = "0.0.0.0")
- #write_response(res : HttpResponse, socket : TCPSocket, keep_alive : Bool) : Bool
Instance Method Detail
Add some route to the route list
def create_request(reader : TCPSocket) : Tuple(HttpRequest | Nil, Bool)
#
Create some request Returns a tuple of the request itself and the status of keep-alive as bool
Create a response corresponding to a HTTP request.
Find a handler given a request, accounting for path parameters
def write_response(res : HttpResponse, socket : TCPSocket, keep_alive : Bool) : Bool
#