cgi
Functions
pub fn handle_request(
f: fn(Request(BitArray)) -> Response(String),
) -> Nil
Load a CGI HTTP request and dispatch a response.
CGI works over stdin and stdout, so be sure your code does not use them for this will likely cause the program to fail.
pub fn load_request() -> Request(BitArray)
Load a CGI HTTP request from the environment.
The body of the request is not loaded. Use read_body
or
with_request_body
to load the body into the request.
pub fn read_body(request: Request(BitArray)) -> Request(BitArray)
Load the body of a request from stdin.
Due to how IO works in JavaScript may not always work on JavaScript,
especially if the body ir larger or on Windows. Consider using the
with_request_body
function instead, which works on all platforms.
pub fn send_response(response: Response(String)) -> Nil
Send a CGI HTTP response by printing it to stdout.
pub fn with_request_body(
request: Request(BitArray),
handle: fn(Request(BitArray)) -> a,
) -> Nil
Load the body of a request from stdin, running a callback with the response with the body.