platform/example/basic.dart
thosakwe 81a4081441 Go
2017-01-14 14:14:20 -05:00

16 lines
519 B
Dart

import 'dart:io';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_user_agent/angel_user_agent.dart';
main() async {
var app = new Angel()..before.add(parseUserAgent(strict: true));
app.get(
'/',
(UserAgent ua) => ua.isChrome
? 'Woohoo! You are running Chrome.'
: 'Sorry, we only support Google Chrome.');
var server = await app.startServer(InternetAddress.ANY_IP_V4, 3000);
print('Listening at http://${server.address.address}:${server.port}');
}