dryLang has a built-in HTTP server powered by Go's net/http. Start one with a single function call.
op() — Start Server| Param | Type | Required | Description |
|---|---|---|---|
port | number | ✅ | Port to listen on |
handler | function | ✅ | Request handler function |
mode | string | ❌ | "uni" (default) or "mul" |
maxWorkers | number | ❌ | Max concurrent workers (default: 100) |
"uni" — Single-threaded with mutex locking. Requests are processed one at a time. Safe for shared state."mul" — Multi-threaded. Each request gets a fresh VM clone with shared globals. Use for high-throughput APIs.The handler receives a request map and must rev (return) a response.
HTTP Method Mappings (shortened for dryLang):
| HTTP Method | dryLang |
|---|---|
| GET | "G" |
| POST | "PO" |
| PUT | "PUT" |
| PATCH | "PAT" |
| DELETE | "DEL" |
| OPTIONS | "OPT" |
| HEAD | "H" |
Return a string for simple text response:
Return a map for custom status and body:
op() is blocking — it runs indefinitely until the process is killed."mul" mode, globals are shared across requests (useful for in-memory state).Starting dryLang server on port XXXX (mode: yyy)...