Skip to content

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.

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

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 })
})

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 })
})

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"
}

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!

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)
Terminal window
chuks upgrade # upgrade to latest
chuks upgrade 0.0.3 # install a specific version
chuks upgrade --list # list all available versions

Downloads the correct platform binary, extracts it, and atomically replaces the current executable. Handles macOS codesign and xattr automatically.

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.

  • 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
  • AOT scoping: Variables declared inside if/else branches 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/query struct fields
  • Error handling: finally block with return and throw-in-finally now 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)
MetricCount
Golden tests (VM + AOT)127
HTTP integration tests60
AOT divergences fixed23 → 0
New commits25