start method

  1. @override
Future<void> start(
  1. Handler handler, {
  2. String context = 'utopia',
  3. String? path,
})
override

Start the server

Implementation

@override
Future<void> start(
  Handler handler, {
  String context = 'utopia',
  String? path,
}) async {
  var shelfHandler = (shelf.Request request) => _handleRequest(
        request,
        context,
        handler,
      );
  if (path != null) {
    shelfHandler = shelf.Cascade()
        .add(createStaticHandler(path))
        .add(
          (request) => _handleRequest(
            request,
            context,
            handler,
          ),
        )
        .handler;
  }

  _server = await shelf_io.serve(
    shelfHandler,
    address,
    port,
    securityContext: securityContext,
    shared: true,
  );
}