AppConfig constructor

AppConfig({
  1. required String appKey,
  2. int serverPort = 3000,
  3. int? totalIsolate,
  4. List<DoxService> services = const <DoxService>[],
  5. List<DtoSchema<Object>> dtos = const <DtoSchema<Object>>[],
  6. MessageResolver? validationMessages,
  7. List globalMiddleware = const <dynamic>[],
  8. List<Router> routers = const <Router>[],
  9. CORSConfig cors = const CORSConfig(),
  10. LoggerConfig logger = const LoggerConfig(),
  11. CacheConfig cache = const CacheConfig(defaultStore: 'file', stores: <String, Map<String, dynamic>>{'file' : <String, dynamic>{'driver' : 'file', 'path' : 'storage/cache'}, 'memory' : <String, dynamic>{'driver' : 'memory'}}),
  12. StorageConfig storage = const StorageConfig(),
  13. OpenApiConfig openApi = const OpenApiConfig(),
  14. SocketIoConfig socketIo = const SocketIoConfig(),
  15. dynamic errorHandler(
    1. Object?,
    2. StackTrace
    ) = defaultErrorHandler,
  16. ResponseHandlerInterface? responseHandler,
  17. int maxBodySize = 10 * 1024 * 1024,
  18. int maxMultipartSize = 100 * 1024 * 1024,
  19. List<String> trustedProxies = const <String>[],
  20. bool compress = false,
  21. ServerBackend server = ServerBackend.native,
})

Implementation

AppConfig({
  required this.appKey,
  this.serverPort = 3000,

  /// isolates (threads) that serve http. Default: one per CPU core.
  int? totalIsolate,
  this.services = const <DoxService>[],
  this.dtos = const <DtoSchema<Object>>[],
  this.validationMessages,
  this.globalMiddleware = const <dynamic>[],
  this.routers = const <Router>[],
  this.cors = const CORSConfig(),
  this.logger = const LoggerConfig(),
  this.cache = const CacheConfig(
    defaultStore: 'file',
    stores: <String, Map<String, dynamic>>{
      'file': <String, dynamic>{'driver': 'file', 'path': 'storage/cache'},
      'memory': <String, dynamic>{'driver': 'memory'},
    },
  ),
  this.storage = const StorageConfig(),
  this.openApi = const OpenApiConfig(),
  this.socketIo = const SocketIoConfig(),
  this.errorHandler = defaultErrorHandler,
  this.responseHandler,
  this.maxBodySize = 10 * 1024 * 1024,
  this.maxMultipartSize = 100 * 1024 * 1024,
  this.trustedProxies = const <String>[],
  this.compress = false,
  this.server = ServerBackend.native,
}) : totalIsolate = totalIsolate ?? Platform.numberOfProcessors;