package mantra.net.http

HttpServer

CLASS public class

Non-blocking TCP socket server and HTTP request multiplexer supporting concurrent worker pools.

🏗️ Constructor Summary

Constructor Signature
def __init__(self, port: Int)

⚙️ Method Summary

Modifier & Return Type Method Signature Description
Void listen() Binds socket and starts HTTP connection polling event loop.
Void route(method: String, path: String, handler: Any) Registers HTTP endpoint handler callback.

🔍 Detailed Method Specifications

pub def listen() -> Void
Binds socket and starts HTTP connection polling event loop.
pub def route(method: String, path: String, handler: Any) -> Void
Registers HTTP endpoint handler callback.

💡 Example Usage

httpserver_example.mantra
let server = HttpServer(8080)
server.route("GET", "/api/status", handle_status)
server.listen()