start static method
Implementation
static Future<VscHttpDeamon> start({
String? path,
int port = 9001,
Object address = 'http://localhost',
}) async {
path ??= Directory.current.path;
final pipeline = const Pipeline()
.addMiddleware(logRequests())
.addMiddleware(corsHeadersMiddleware(port: port))
.addHandler(createStaticHandler(path, defaultDocument: 'index.html'));
final server = await io.serve(pipeline, address, port);
server.defaultResponseHeaders.remove('X-Content-Type-Options', 'nosniff');
server.defaultResponseHeaders.remove('x-content-type-options', 'nosniff');
server.defaultResponseHeaders
.add('x-frame-options', 'ALLOW-FROM http://localhost:$port');
return VscHttpDeamon._(server, path);
}