The object web is available from everywhere. This will change in the future.
Interacting with STDIO is IO and will be
isolated.
You can send the run on message to web. It expects the first object to be
your application (more on that later) and the second one the bind address and
port in the format: 0.0.0.0:3000.
You can also send the run message on web. It only expects the application,
and not the bind address and port. It takes that from the PORT environment
variable.
Your app needs to be an object that can receive the call message. It will be
called with the environment dictionary that represents the request. It expects
that your return an array that represents the response.
Environment Dictionary
The environment dictionary has the following keys:
request_method: The request method in upper case (for example:"GET")path: The path that was requested (for example:"/the/path")query: The query part of the request (for example:"foo=bar&beep=boop")
Response Array
The response array has three elements:
- The first element is the status code as a String (for example:
"200") - The second element are the headers as a dictionary (for example:
@[ "Content-Type" "text/html" ]) - The third element is an array of strings that represent the body (for
example:
[ "<h1>Halunke!</h1>" ])