serve function

Future<ServerHandle> serve(
  1. Future<Response> handler(
    1. Request
    ), {
  2. String host = '127.0.0.1',
  3. int port = 8080,
  4. TlsConfig? tls,
  5. bool h2c = false,
  6. CorsOptions? cors,
  7. String? staticDir,
  8. String? spaRoot,
  9. bool compression = true,
  10. Duration requestTimeout = const Duration(seconds: 60),
  11. int maxBodyBytes = 1024 * 1024,
  12. Iterable<DVRouteBodyLimit> routeBodyLimits = const <DVRouteBodyLimit>[],
})

Serves the handler configuration.

Implementation

Future<ServerHandle> serve(
  Future<Response> Function(Request) handler, {
  String host = '127.0.0.1',
  int port = 8080,
  TlsConfig? tls,
  bool h2c = false,
  CorsOptions? cors,
  String? staticDir,
  String? spaRoot,
  bool compression = true,
  Duration requestTimeout = const Duration(seconds: 60),
  int maxBodyBytes = 1024 * 1024,
  Iterable<DVRouteBodyLimit> routeBodyLimits = const <DVRouteBodyLimit>[],
}) async {
  throw StateError(
    'Dartvel Shelf server requires the FFI native backend. Build with dart.library.ffi and the ffigen-generated server bindings.',
  );
}