Skip to content

Commit

Permalink
Async/await
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins committed Sep 16, 2019
1 parent 416cf72 commit 1c526c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ import 'package:http_multi_server/http_multi_server.dart';
import 'package:shelf/shelf.dart' as shelf;
import 'package:shelf/shelf_io.dart' as shelf_io;
void main() {
void main() async {
// Both http://127.0.0.1:8080 and http://[::1]:8080 will be bound to the same
// server.
HttpMultiServer.loopback(8080).then((server) {
shelf_io.serveRequests(server, (request) {
return shelf.Response.ok("Hello, world!");
});
var server = await HttpMultiServer.loopback(8080);
shelf_io.serveRequests(server, (request) {
return shelf.Response.ok("Hello, world!");
});
}
```
Expand Down
9 changes: 4 additions & 5 deletions example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import 'package:http_multi_server/http_multi_server.dart';
import 'package:shelf/shelf.dart' as shelf;
import 'package:shelf/shelf_io.dart' as shelf_io;

void main() {
void main() async {
// Both http://127.0.0.1:8080 and http://[::1]:8080 will be bound to the same
// server.
HttpMultiServer.loopback(8080).then((server) {
shelf_io.serveRequests(server, (request) {
return shelf.Response.ok("Hello, world!");
});
var server = await HttpMultiServer.loopback(8080);
shelf_io.serveRequests(server, (request) {
return shelf.Response.ok("Hello, world!");
});
}

0 comments on commit 1c526c5

Please sign in to comment.