initialize method
Implementation
Future<void> initialize({
required Map<String, dynamic> config,
List<String> args = const [],
}) async {
await Localization().init();
IoCContainer().register<RequestHandler>(() => RequestHandler());
IoCContainer().register<SessionManager>(
() => SessionManager(),
singleton: true,
);
// APP_KEY keys session encryption and the framework's HMACs, so a
// short one weakens both. 32 characters is the minimum.
final appKey = env('APP_KEY');
if (appKey == null || appKey is! String || appKey.length < 32) {
throw Exception(
'APP_KEY missing or too short (must be at least 32 characters). '
'Generate one with `openssl rand -base64 32` and add it to .env',
);
}
_server = BaseHttpServer(config: config, args: args);
_server.startServer();
}