angel3_user_agent 8.1.1 copy "angel3_user_agent: ^8.1.1" to clipboard
angel3_user_agent: ^8.1.1 copied to clipboard

Angel3 middleware to parse and inject a User Agent object into requests.

example/example.dart

//import 'dart:io';
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_framework/http.dart';
//import 'package:angel3_user_agent/angel3_user_agent.dart';
//import 'package:user_agent_analyzer/user_agent_analyzer.dart';

void main() async {
  var app = Angel();
  var http = AngelHttp(app);

  //TODO: To be reviewed
  /*
  app.get(
    '/',
    waterfall([
      parseUserAgent,
      (req, res) {
        var ua = req.container.make<UserAgent>() as UserAgent;
        return ua.isChrome
            ? 'Woohoo! You are running Chrome.'
            : 'Sorry, we only support Google Chrome.';
      },
    ]),
  );

  var server = await http.startServer(InternetAddress.anyIPv4, 3000);
  print('Listening at http://${server.address.address}:${server.port}');
  */
}
0
likes
140
pub points
9%
popularity

Publisher

verified publisherdukefirehawk.com

Angel3 middleware to parse and inject a User Agent object into requests.

Homepage
Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

angel3_framework, lints, user_agent_analyzer

More

Packages that depend on angel3_user_agent