platform/example/main.dart

20 lines
515 B
Dart
Raw Normal View History

2018-02-07 04:38:26 +00:00
import 'package:angel_framework/angel_framework.dart';
main() async {
var app = new Angel();
app.get('/', () => 'Welcome to Angel!');
app.get('/greet/:name', (String name) => 'Hello, $name!');
app.use((RequestContext req) async {
throw new AngelHttpException.notFound(
message: 'Unknown path: "${req.uri.path}"',
);
});
var http = new AngelHttp(app);
var server = await http.startServer('127.0.0.1', 3000);
print('Listening at http://${server.address.address}:${server.port}');
}