platform/packages/framework/performance/hello/main.dart

24 lines
647 B
Dart
Raw Normal View History

/// A basic server that prints "Hello, world!"
library performance.hello;
2021-05-14 10:34:09 +00:00
import 'package:angel3_framework/angel3_framework.dart';
import 'package:angel3_framework/http.dart';
2021-05-14 10:34:09 +00:00
void 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}');
}