start static method
Start the app of config in this isolate and give a client for it.
It runs the providers (eg. the ORM provider) and registers the routes,
like the real start. With AppConfig.tls the server speaks HTTPS, and
the client trusts only the certificate of that config. It always
listens on 127.0.0.1 and a free
port, and runs one isolate. serverPort and totalIsolate of
config are not used.
Implementation
static Future<DoxTestClient> start(AppConfig config) async {
Dox dox = Dox();
dox.initialize(config);
dox.addProviders(config.providers);
await dox.startProviders();
DoxServer server = DoxServer();
server.setResponseHandler(config.responseHandler);
HttpServer http = await server.listen(
0,
address: InternetAddress.loopbackIPv4,
);
TlsOptions? tls = config.tls;
if (tls == null) {
return DoxTestClient(Uri.parse('http://127.0.0.1:${http.port}'));
}
return DoxTestClient._copy(
Uri.parse('https://127.0.0.1:${http.port}'),
const <String, String>{},
_clientFor(tls),
null,
);
}