Core
js-cgi provides a small set of built-in globals and functions for handling HTTP requests and generating responses. No extensions are required — these are always available.
Globals
| Global | Type | Description |
|---|---|---|
request | object | Incoming HTTP request data |
response | object | Methods to control the HTTP response |
Functions
| Function | Description |
|---|---|
print(value, ...) | Append values to the response body |
include(path) | Execute another .js file in the same context |
Modules
ES modules (import/export) are supported for organising code into reusable files.
Default Behaviour
- Content-Type defaults to
text/html - Status code defaults to
200 - The response body is everything output by
print() - Scripts execute synchronously from top to bottom