Site Mode (!REQUEST)
Place an index.oql file at /root/sites/{subdomain}/. Every HTTP request to that subdomain runs the file. OQL is the entire web server — routing, auth, response.
Point your domain or subdomain to
41.61.20.37 and add it to your domain list at accounts.ocalt.com. OQL handles TLS, routing, and query execution automatically.Request context — immutable variables
| Variable | Description |
|---|---|
!REQUEST(path) | URL path — e.g. /about |
!REQUEST(method) | HTTP method: GET, POST, PUT, DELETE |
!REQUEST(body) | Raw request body as text |
!REQUEST(param:name) | Query string parameter: ?name=value |
!REQUEST(form:field) | Form POST field |
!REQUEST(header:name) | HTTP header value |
!GET(name) | Alias for !REQUEST(param:name) |
!POST(field) | Alias for !REQUEST(form:field) |
!COOKIE(name) | Cookie value |
Simple website — index.oql
IF !REQUEST(path) IS EQUAL TO "/"
OPEN NEST
EMIT "<h1>Welcome</h1><p>Powered by OQL.</p>"
CLOSE NEST
ELSE IF !REQUEST(path) IS EQUAL TO "/about"
OPEN NEST
EMIT "<h1>About</h1>"
CLOSE NEST
ELSE
OPEN NEST
STATUS 404
AFTER EMIT "Page not found"
CLOSE NEST
REST API endpoint
IF !REQUEST(path) IS EQUAL TO "/api/products"
OPEN NEST
IF !REQUEST(method) IS IDENTICAL TO "GET"
OPEN NEST
QUERY "products" FROM "shop" SET ?rows
AFTER HEADER "Content-Type" AS "application/json"
AFTER CAST ?rows AS "json" SET ?json_str
AFTER EMIT ?json_str
CLOSE NEST
ELSE IF !REQUEST(method) IS IDENTICAL TO "POST"
OPEN NEST
PARSE JSON !REQUEST(body) SET ?data
AFTER INSERT ?data INTO "products" FROM "shop" SET ?id
AFTER STATUS 201
AFTER HEADER "Content-Type" AS "application/json"
AFTER EMIT `{"id":"` & ?id & `"}`
CLOSE NEST
CLOSE NEST
ELSE OPEN NEST STATUS 404 CLOSE NEST
DOMAIN LIST / ADD / REMOVE
| Verb | Description |
|---|---|
DOMAIN LIST SET ?domains | List all custom domains configured in the namespace |
DOMAIN SEARCH "query" SET ?results | Search domains |
DOMAIN ADD "example.com" | Register a custom domain to the namespace |
DOMAIN REMOVE "example.com" | Deregister a domain |
DOMAIN LIST SET ?domains
AFTER EMIT ?domains
DOMAIN ADD "myapp.com"
AFTER EMIT "Domain added — point DNS A record to 41.61.20.37"