The client sends a request
For example, GET /customers/42?include=balance with an authorization header.
Product knowledge · Beginner · One process
Follow GET /customers/42 from route
declaration to the client response. Learn what the application writes,
which request values are available and where each failure is handled.
01 · One request in one process
For example, GET /customers/42?include=balance with an authorization header.
GET /customers/{id} matches and the handler receives the request values.
The application validates id, checks permission and loads the customer.
For example, 200 with JSON, 404 when absent or 403 when forbidden.
The runtime sends the response and the application remains ready for the next request.
Accepts connections, reads HTTP, selects routes, applies limits and sends responses.
Presents requests and responses as natural Go, JVM, Python, JavaScript or C/C++ values.
Owns user authentication, business validation, database access and response content.
02 · Declare and start
declare address + routes + handlers
↓ start
success → running service + actual address
failure → fix configuration and start again
startstartstartFor local learning, use loopback and port 0 so the operating
system selects an available port. Each language example prints the
actual address so it can be called immediately.
03 · Method and path
GET /customers/{id} and POST /customers are different routes.
For /customers/42, the handler receives id = 42; decode and validate it before use.
?include=balance adds an option. Distinguish absent, empty and repeated values.
Use headers for metadata such as authorization, content type and request ID, not large business payloads.
An inbound route differs from an outbound path.
The server declares /customers/{id}; a client calls a
concrete path such as /customers/42?include=balance.
04 · Request data
The handler receives method, path parameters, query, headers and body through the natural API of the chosen language. A create-customer handler can read JSON, validate required fields and convert it to an application model.
id = 42; validate its format and access permission.
include = balance; accept only documented options.
Read authorization, content type or request ID when the endpoint needs them.
Read text, JSON or small binary content within configured limits.
Large files or incrementally arriving data belong in the advanced Streaming lesson.
05 · Business handler
Example: find the customer by id; return 200
when found and 404 otherwise. Keep internal diagnostics in
safe logs instead of returning them directly to the client.
06 · Response
200, 201, 400, 404 or another suitable status.Do not hand-write Content-Length or
Transfer-Encoding; use the CoAkka HTTP Runtime response API.
07 · Failure by stage
| Stage | Example | Owner action |
|---|---|---|
| Startup | Invalid route or port already in use | Fix configuration; the service has not accepted requests. |
| Before handler | Malformed request or configured limit exceeded | Fix the client or limit; business logic did not run. |
| In handler | Forbidden, validation or database failure | Return a suitable status and keep diagnostics safe. |
| While responding | Response too large or already completed | Fix the handler; do not submit a second response. |
| Timeout/disconnect | The client no longer waits for a result | Do not retry blindly; business work may have run. |
| During shutdown | Deadline expires while work remains | Keep the service and dependencies alive, then follow operational policy. |
Do not turn every failure into HTTP 500. Validation, forbidden, not found, overload and timeout require different actions. Use the error kind supplied by the API; never parse error text.
08 · Stop the service
remove the instance from the load balancer when present
→ call close with a finite deadline
→ wait for active requests
→ release dependencies only after close succeeds
09 · Beginner review