server #
fn new #
fn new(addr string, rtr &router.Router, config ServerConfig) &Server
new creates a new Server instance
fn raw_callback #
fn raw_callback(mut pv picoev.Picoev, fd int, events int)
raw_callback is the entry point called by picoev for each FD event This is where all HTTP requests enter the Varel framework
fn (ServerRequestParams) request_done #
fn (mut params ServerRequestParams) request_done(fd int)
request_done resets state for a file descriptor after request is complete
struct Server #
struct Server {
pub:
addr string // Address to bind to (e.g., ":8080" or "localhost:3000")
router &router.Router // Varel's radix tree router
config ServerConfig // Server configuration
pub mut:
db &vareldb.DB = unsafe { nil } // Database connection (lazy initialized)
picoev &picoev.Picoev = unsafe { nil } // picoev instance
}
Server is the main single-process HTTP server
fn (Server) listen #
fn (mut s Server) listen() !
listen starts the HTTP server (single process, picoev event loop)
struct ServerConfig #
struct ServerConfig {
pub:
read_timeout_secs int = 30
write_timeout_secs int = 30
max_read int = 5_5000000 // 5MB default (for file uploads)
max_write int = 116384 // 16KB
}
ServerConfig configures the server