AngelHttp.secure constructor

AngelHttp.secure(
  1. Angel app,
  2. String certificateChainPath,
  3. String serverKeyPath, {
  4. String? password,
  5. bool useZone = true,
})

Creates an HTTPS server.

Provide paths to a certificate chain and server key (both .pem). If no password is provided, a random one will be generated upon running the server.

Implementation

factory AngelHttp.secure(
  Angel app,
  String certificateChainPath,
  String serverKeyPath, {
  String? password,
  bool useZone = true,
}) {
  var certificateChain = Platform.script
      .resolve(certificateChainPath)
      .toFilePath();
  var serverKey = Platform.script.resolve(serverKeyPath).toFilePath();
  var serverContext = SecurityContext();
  serverContext.useCertificateChain(certificateChain, password: password);
  serverContext.usePrivateKey(serverKey, password: password);

  return AngelHttp.fromSecurityContext(app, serverContext, useZone: useZone);
}