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

19 lines
439 B
Dart
Raw Normal View History

2017-08-03 17:52:10 +00:00
/// A basic server that prints "Hello, world!"
library performance.hello;
import 'dart:io';
2021-11-29 01:04:50 +00:00
Future<void> main() {
2018-12-09 04:18:31 +00:00
return HttpServer.bind('127.0.0.1', 3000, shared: true).then((server) {
print('Listening at http://${server.address.address}:${server.port}');
2017-08-03 17:52:10 +00:00
server.listen((request) {
if (request.uri.path == '/') {
request.response.write('Hello, world!');
}
request.response.close();
});
});
}