Server class

Core HTTP server for Khadem.

Orchestrates routing, global middleware, static file serving and lifecycle operations. Routing configuration should be provided via injectRoutes so route definitions live in a single place.

Constructors

Server()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addMiddlewareHandler(MiddlewareHandler handler, {MiddlewarePriority priority = MiddlewarePriority.global, String? name}) → void
Register a global middleware handler.
applyMiddleware(List<Middleware> middlewares) → void
Register multiple global middlewares.
configure({bool? autoCompress, Duration? idleTimeout}) → void
Configures server settings.
getMiddlewareGroup(String name) List<Middleware>
Get a registered middleware group.
injectRoutes(void register(Router router)) → void
Inject route definitions into the server's internal router.
middlewareGroup(String name, List<Middleware> middlewares) → void
Register a middleware group.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reload() Future<void>
Trigger a lifecycle reload. In development, lightweight endpoints are injected to allow manual reloads.
serveStatic([String path = 'public']) → void
Serve files from path (defaults to public).
start({int port = 8080, String? host}) Future<void>
Start the HTTP server on port and optional host.
stop() Future<void>
Stop the HTTP server.
toString() String
A string representation of this object.
inherited
useMiddlewareGroup(String name) → void
Use a registered middleware group.

Operators

operator ==(Object other) bool
The equality operator.
inherited