App constructor
App()
Initializes a new kronix application.
During initialization, the framework:
- Loads configuration from
.env. - Registers the Router, ExceptionHandler, and WebSocketHub into the global DI container.
- Sets up system health and readiness routes.
Implementation
App() {
Config.load();
di.singleton(_router);
di.singleton<ExceptionHandler>(exceptionHandler);
di.singleton(_wsHub);
di.singleton<Storage>(LocalStorage(
root: Config.get('STORAGE_ROOT', 'storage')!,
baseUrl: Config.get('STORAGE_URL', '/storage')!,
));
// Resolve Queue driver from config
final queueDriverName = Config.get('QUEUE_DRIVER', 'memory')!;
final QueueDriver driver = _resolveQueueDriver(queueDriverName);
di.singleton<Queue>(Queue(driver: driver));
_setupDefaultRoutes();
}