startServer function

Future<HttpServer> startServer({
  1. required String projectRoot,
  2. String host = 'localhost',
  3. int port = 4077,
})

Bind the Shelf handler on host:port. Returns the live HttpServer so the caller (the serve command) can keep the process alive.

Implementation

Future<HttpServer> startServer({
  required String projectRoot,
  String host = 'localhost',
  int port = 4077,
}) async {
  final handler = buildHandler(projectRoot);
  return shelf_io.serve(handler, host, port);
}