#
AppServer.startup
— Function.
startup(port::Int = 8000) :: Void
Starts the web server on the configurated port. Automatically invoked when Genie is started with the s
or the server:start
command line params. Can be manually invoked from the REPL as well, when starting Genie without the above params – ideally async
to allow reusing the REPL session.
Examples
julia> @spawn AppServer.startup()
Listening on 0.0.0.0:8000...
Future(1,1,1,Nullable{Any}())
#
AppServer.handle_connect
— Function.
handle_connect(client::HttpServer.Client) :: Void
Connection callback for HttpServer. Stores the Request IP in the current task's local storage.
#
AppServer.handle_request
— Function.
handle_request(req::Request, res::Response, ip::IPv4 = ip"0.0.0.0") :: Response
HttpServer handler function - invoked when the server gets a request.
#
AppServer.sign_response!
— Function.
sign_response!(res::Response) :: Response
Adds a signature header to the response using the value in Genie.config.server_signature
. If Genie.config.server_signature
is empty, the header is not added.
#
AppServer.log_request
— Function.
log_request(req::Request) :: Void
Logs information about the request.
#
AppServer.log_response
— Function.
log_response(req::Request, res::Response) :: Void
Logs information about the response.
#
AppServer.log_request_response
— Function.
log_request_response(req_res::Union{Request,Response}) :: Void
Helper function that logs Request
or Response
objects.
#
AppServer.parse_inner_dict
— Function.
parse_inner_dict{K,V}(d::Dict{K,V}) :: Dict{String,String}
Helper function that knows how to parse a Dict
containing Request
or Response
data and prepare it for being logged.