shelf_enforces_ssl 1.0.0 copy "shelf_enforces_ssl: ^1.0.0" to clipboard
shelf_enforces_ssl: ^1.0.0 copied to clipboard

Enforces that users can only make API requests over HTTPS (SSL).

example/shelf_enforces_ssl_example.dart

// ignore_for_file: avoid_print

import 'package:shelf_enforces_ssl/shelf_enforces_ssl.dart';
import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart' as shelf_io;

void main() async {
  final handler = const Pipeline()
      .addMiddleware(enforceSSL())
      .addMiddleware(logRequests())
      .addHandler(_echoRequest);

  final server = await shelf_io.serve(handler, 'localhost', 8080);

  print('Serving at https://${server.address.host}:${server.port}');
}

Response _echoRequest(Request request) =>
    Response.ok('Request for "${request.url}"');
9
likes
0
pub points
57%
popularity

Publisher

verified publisherjxstxn.dev

Enforces that users can only make API requests over HTTPS (SSL).

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

shelf

More

Packages that depend on shelf_enforces_ssl