platform/framework/performance/hello/main.dart

24 lines
639 B
Dart
Raw Normal View History

/// A basic server that prints "Hello, world!"
library performance.hello;
import 'package:angel_framework/angel_framework.dart';
2018-10-22 15:54:41 +00:00
import 'package:angel_framework/http.dart';
2017-11-28 18:14:50 +00:00
main() async {
2019-05-02 22:48:31 +00:00
var app = Angel();
var http = AngelHttp.custom(app, startShared, useZone: false);
2017-11-28 18:14:50 +00:00
app.get('/', (req, res) => res.write('Hello, world!'));
2018-11-15 21:22:45 +00:00
app.optimizeForProduction(force: true);
2017-09-22 14:53:49 +00:00
var oldHandler = app.errorHandler;
app.errorHandler = (e, req, res) {
print('Oops: ${e.error ?? e}');
print(e.stackTrace);
return oldHandler(e, req, res);
};
2018-02-07 05:36:24 +00:00
2018-12-09 04:18:31 +00:00
await http.startServer('127.0.0.1', 3000);
print('Listening at ${http.uri}');
}