Examples
This page is not available in the selected language. You are viewing the English documentation for the same version.
0.0.19 snapshot Documentation
Examples are organized by task. Each linked page supplies a complete program, execution instructions and backend requirements. File, server and database prerequisites are stated explicitly.
| Task | Example and environment |
|---|---|
| First program | Hello Ku; interpreter or native C |
| Chinese and emoji | Strings; interpreter or listed native methods |
| JSON round trips and errors | JSON; interpreter or synchronous native C |
| Write and read a file | Filesystem; creates a file beside the source |
| Dates and waiting | Time; wall-clock versus monotonic time |
| HTTP server and requests | HTTP; start the local server first |
| Tasks and await | Async calls; one-use handles and explicit Results |
| Multi-file project | Packages and modules; local imports |
| Database queries | PG / Redis / MySQL; native C and real services |
| Binary data and TCP | bytes / net; native C |
The repository’s examples directory contains larger examples.
Native Task examples
Section titled “Native Task examples”| Complete program | Requirement and expected result |
|---|---|
async-server.ku in HTTP |
Native C; free port 8080; GET /health returns ready |
task-json.ku in JSON |
Native Task scalar object encoding; deterministic JSON text |
task-sleep.ku in time |
Integer timer wait; prints awake; no external service |
async-pg.ku in database clients |
Native C, libpq and a real private PG configuration; GET /read returns Ku |
These programs demonstrate different supported paths. They do not establish a performance limit, a full async library or production readiness.