Chuks v0.0.4 — The HTTP Release
Chuks v0.0.4 is the biggest release yet. The HTTP server gets a complete API overhaul, the testing infrastructure matures with 127 golden tests, and the toolchain gains self-update capabilities.
Highlights
Section titled “Highlights”Fiber-Inspired HTTP API
Section titled “Fiber-Inspired HTTP API”The HTTP server now has a rich, Express/Fiber-style API:
import { createServer } from "std/http"
function main() { var app = createServer()
app.get("/users/:id", (req, res) => { var id = req.params.id var page = req.query.page
res.status(200) res.header("X-Request-Id", "abc123") res.cookie("session", "xyz", { httpOnly: true }) res.json({ id: id, page: page }) })
app.listen(8080)}New response methods: res.redirect(), res.type(), res.cookie(), res.clearCookie()
New request properties: req.ip, req.hostname, req.protocol, req.secure, req.originalUrl, req.cookie
Typed Request Body Parsing
Section titled “Typed Request Body Parsing”Parse incoming JSON directly into a typed structure:
dataType CreateUser { name: string email: string}
app.post("/users", (req, res) => { var user = req.parseBody<CreateUser>() res.json({ created: user.name })})File Uploads
Section titled “File Uploads”Full multipart/form-data support with req.files and req.formData:
app.post("/upload", (req, res) => { var file = req.files[0] println(file.filename) // "photo.jpg" println(file.extension) // ".jpg" println(file.size) // 1048576 res.json({ uploaded: file.filename })})Channels
Section titled “Channels”First-class communication between concurrent tasks:
import { Channel } from "std/channel"
async function producer(ch: Channel): Task<void> { ch.send("hello") ch.send("world") ch.close()}
function main() { var ch = new Channel(10) spawn producer(ch)
var msg = ch.receive() println(msg) // "hello"}Default Parameters
Section titled “Default Parameters”Functions can now have default parameter values:
function greet(name: string = "World"): string { return "Hello, " + name + "!"}println(greet()) // Hello, World!println(greet("Chuks")) // Hello, Chuks!Function Type Annotations
Section titled “Function Type Annotations”Arrow function type syntax in function signatures:
function apply(value: int, transform: (int) => int): int { return transform(value)}var result = apply(5, (x: int): int => x * 2)Self-Update Command
Section titled “Self-Update Command”chuks upgrade # upgrade to latestchuks upgrade 0.0.3 # install a specific versionchuks upgrade --list # list all available versionsDownloads the correct platform binary, extracts it, and atomically replaces the current executable. Handles macOS codesign and xattr automatically.
Silent Toolchain Auto-Installer
Section titled “Silent Toolchain Auto-Installer”When you run chuks build for the first time, Chuks automatically downloads and installs everything it needs. No prompts, no manual setup — it just works.
Testing Infrastructure
Section titled “Testing Infrastructure”- 127 golden tests passing on both VM and AOT
- 60 HTTP integration tests covering routes, middleware, uploads, error handling
- Tests run in parallel, comparing VM and AOT output for behavioral parity
- Nondeterministic tests (timestamps, random) handled gracefully
Bug Fixes
Section titled “Bug Fixes”- AOT scoping: Variables declared inside
if/elsebranches within loops now scoped correctly - TCP fragmentation: HTTP server correctly reassembles TCP segments split across network callbacks
- AOT type assertions: Fixed invalid type assertions on
Request.params/querystruct fields - Error handling:
finallyblock withreturnandthrow-in-finallynow behave correctly - Map access: Dot-notation access/set on maps works properly; missing keys return
null - 5 AOT transpiler limitations resolved (string conversion, array references, bitwise operators)
Numbers
Section titled “Numbers”| Metric | Count |
|---|---|
| Golden tests (VM + AOT) | 127 |
| HTTP integration tests | 60 |
| AOT divergences fixed | 23 → 0 |
| New commits | 25 |