run method

  1. @override
Future<HttpServer> run({
  1. required InternetAddress ip,
  2. required int port,
  3. List<String> mounts = const ['/'],
  4. String? poweredByHeader = 'Dart Pluggable',
  5. SecurityContext? securityContext,
  6. bool shared = false,
})

Runs the HTTP server with the specified configuration.

ip: The IP address to listen on. port: The port number to listen on. mounts: List of URL paths to mount the server on. poweredByHeader: Value for the X-Powered-By header. securityContext: SSL/TLS security context for HTTPS. shared: Whether to share the server with other isolates. Returns a Future that completes with the running HttpServer.

Implementation

@override
Future<HttpServer> run({
  // required Handler handler,
  required InternetAddress ip,
  required int port,
  List<String> mounts = const ['/'],
  String? poweredByHeader = 'Dart Pluggable',
  SecurityContext? securityContext,
  bool shared = false,
}) {
  final router = Router();

  for (final path in mounts) {
    router.mount(
      path,
      rootHandler,
    );
  }

  return serve(
    router.call,
    ip,
    port,
    shared: true,
    poweredByHeader: poweredByHeader,
  );
}