platform/packages/user_agent/angel_user_agent/example/example.dart

31 lines
828 B
Dart
Raw Normal View History

2022-11-18 13:52:12 +00:00
//import 'dart:io';
2021-06-21 05:43:02 +00:00
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_framework/http.dart';
2022-11-18 13:52:12 +00:00
//import 'package:angel3_user_agent/angel3_user_agent.dart';
//import 'package:user_agent_analyzer/user_agent_analyzer.dart';
2018-09-11 21:21:06 +00:00
2021-06-20 12:37:20 +00:00
void main() async {
2021-02-14 05:22:25 +00:00
var app = Angel();
2024-05-21 16:32:59 +00:00
// ignore: unused_local_variable
2021-02-14 05:22:25 +00:00
var http = AngelHttp(app);
2018-09-11 21:21:06 +00:00
2021-06-21 06:16:06 +00:00
//TODO: To be reviewed
2021-09-14 01:23:03 +00:00
/*
2018-09-11 21:21:06 +00:00
app.get(
'/',
waterfall([
parseUserAgent,
(req, res) {
2021-06-21 06:16:06 +00:00
var ua = req.container.make<UserAgent>() as UserAgent;
2018-09-11 21:21:06 +00:00
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}');
2021-09-14 01:23:03 +00:00
*/
2018-09-11 21:21:06 +00:00
}