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

19 lines
439 B
Dart
Raw Normal View History

/// A basic server that prints "Hello, world!"
library performance.hello;
import 'dart:io';
Future<void> main() {
return HttpServer.bind('127.0.0.1', 3000, shared: true).then((server) {
print('Listening at http://${server.address.address}:${server.port}');
server.listen((request) {
if (request.uri.path == '/') {
request.response.write('Hello, world!');
}
request.response.close();
});
});
}