run method
Future<HttpServer>
run({
- required InternetAddress ip,
- required int port,
- List<
String> mounts = const ['/'], - String? poweredByHeader = 'Dart Pluggable',
- SecurityContext? securityContext,
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,
);
}