galileo_user_agent 3.0.0 copy "galileo_user_agent: ^3.0.0" to clipboard
galileo_user_agent: ^3.0.0 copied to clipboard

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

example/example.dart

import 'dart:io';
import 'package:galileo_framework/galileo_framework.dart';
import 'package:galileo_framework/http.dart';
import 'package:galileo_user_agent/galileo_user_agent.dart';

main() async {
  var app = Galileo();
  var http = GalileoHttp(app);

  // TODO: Commented out due to unknow class
  /*
  app.get(
    '/',
    waterfall([
      parseUserAgent,
      (req, res) {
        var ua = req.container.make<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}');
}
1
likes
40
pub points
0%
popularity

Publisher

verified publishergalileodart.com

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

Homepage
Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

galileo_framework

More

Packages that depend on galileo_user_agent