platform/lib/src/http/http.dart

20 lines
676 B
Dart
Raw Normal View History

/// Various libraries useful for creating highly-extensible servers.
2016-02-28 13:11:17 +00:00
library angel_framework.http;
2017-04-01 01:00:24 +00:00
import 'dart:async';
import 'dart:io';
2018-02-07 04:34:08 +00:00
export 'angel_http.dart';
2018-02-07 05:26:33 +00:00
export 'http_request_context.dart';
export 'http_response_context.dart';
2016-06-27 00:20:42 +00:00
2019-04-28 17:44:47 +00:00
/// Boots a shared server instance. Use this if launching multiple isolates.
2018-06-23 03:59:41 +00:00
Future<HttpServer> startShared(address, int port) =>
HttpServer.bind(address ?? '127.0.0.1', port ?? 0, shared: true);
2017-04-01 01:00:24 +00:00
2018-06-23 03:59:41 +00:00
Future<HttpServer> Function(dynamic, int) startSharedSecure(
SecurityContext securityContext) {
2017-10-04 14:09:12 +00:00
return (address, int port) => HttpServer.bindSecure(
2018-06-08 07:06:26 +00:00
address ?? '127.0.0.1', port ?? 0, securityContext,
2017-04-01 01:00:24 +00:00
shared: true);
}