API DOCS v0.10

CGI-Node.js Manual & Documentation

CgiHttpContext

These are the global objects and methods that are accessible to the running CGI scripts. In Node.js terms, this is the VM Context that will be used to run the requested scripts.

process

The process object is the global Node.js process object and can be accessed from anywhere. It contains all the information needed to run the CGI scripts within an HTTP server context. The process.stdin and process.stdout are used to read and write content. The environment variables (process.env) are used to pass process and HTTP request headers. CGI-Node reads all the HTTP request information and provides a clean API to access this information and send HTTP headers and content back to the client.

See request and response object below for more details.

request

This represents the HTTP request. It contains all the request information. This includes the headers, URL, query string, post data and server information.

This object is created before the requested script is executed.

See CgiHttpRequest for more details.

response

This object is created by the initially that implements header and write methods to send data back to the client.

See CgiHttpResponse for more details.

write(chunk, [encoding])

This method is an alias to response.write(chunk, [encoding])

See response.write(chunk, [encoding]) for more details.

mapPath(path)

Resolves the file path relative to the root of the website as defined within the configuration, or if not specified, the base script path is used.

include(path)

Executes the given file within the current context. If the file is a '.js' script, it is executed as is, otherwise it is assumed to be an ASP page and is parsed/processed first.

The given path is resovled using mapPath method.

CgiNodeInfo()

This method is similar to PhpInfo(). It outputs the HTTP request, server information and variables to the output stream in HTML format. This is very helpful to determine what headers and environment variables are available.

CgiHttpRequest

Coming soon...

If you can't wait for this section then peek at the cgi-node.js code :)

CgiHttpResponse

Coming soon...

If you can't wait for this section then peek at the cgi-node.js code :)