Genie.AppServer.ServersCollectionType
ServersCollection(webserver::Union{Task,Nothing}, websockets::Union{Task,Nothing})

Represents a object containing references to Genie's web and websockets servers.

Genie.AppServer.SERVERSConstant
SERVERS

ServersCollection constant containing references to the current app's web and websockets servers.

Genie.AppServer.startupFunction
startup(port::Int = Genie.config.server_port, host::String = Genie.config.server_host;
    ws_port::Int = Genie.config.websockets_port, async::Bool = ! Genie.config.run_as_server) :: ServersCollection

Starts the web server.

Arguments

  • port::Int: the port used by the web server
  • host::String: the host used by the web server
  • ws_port::Int: the port used by the Web Sockets server
  • async::Bool: run the web server task asynchronously

Examples

julia> up(8000, "127.0.0.1", async = false)
[ Info: Ready!
Web Server starting at http://127.0.0.1:8000
Genie.AppServer.upFunction
startup(port::Int = Genie.config.server_port, host::String = Genie.config.server_host;
    ws_port::Int = Genie.config.websockets_port, async::Bool = ! Genie.config.run_as_server) :: ServersCollection

Starts the web server.

Arguments

  • port::Int: the port used by the web server
  • host::String: the host used by the web server
  • ws_port::Int: the port used by the Web Sockets server
  • async::Bool: run the web server task asynchronously

Examples

julia> up(8000, "127.0.0.1", async = false)
[ Info: Ready!
Web Server starting at http://127.0.0.1:8000
Genie.AppServer.downFunction
down(; webserver::Bool = true, websockets::Bool = true) :: ServersCollection

Shuts down the servers optionally indicating which of the webserver and websockets servers to be stopped.

Genie.AppServer.update_configFunction
update_config(port::Int, host::String, ws_port::Int) :: Nothing

Updates the corresponding Genie configurations to the corresponding values for port, host, and ws_port, if these are passed as arguments when starting up the server.

Genie.AppServer.handle_requestFunction
handle_request(req::HTTP.Request, res::HTTP.Response, ip::IPv4 = IPv4(Genie.config.server_host)) :: HTTP.Response

Http server handler function - invoked when the server gets a request.

Genie.AppServer.setup_http_handlerFunction
setup_http_handler(req::HTTP.Request, res::HTTP.Response = HTTP.Response()) :: HTTP.Response

Configures the handler for the HTTP Request and handles errors.

Genie.AppServer.handle_ws_requestFunction
handle_ws_request(req::HTTP.Request, msg::String, ws_client, ip::IPv4 = IPv4(Genie.config.server_host)) :: String

Http server handler function - invoked when the server gets a request.