quests.</p>
<pre class="language-dart"><code>final HOST = InternetAddress.loopbackIPv4;
final PORT = 80;

HttpServer.bind(HOST, PORT).then((_server) {
  _server.listen((HttpRequest request) {
    switch (request.method) {
      case 'GET':
        handleGetRequest(request);
        break;
      case 'POST':
        ...
    }
  },
  onError: handleError);    // listen() failed.
}).catchError(handleError);
</code></pre>
<p>An HttpRequest object provides access to the associated <a href="../dart-io/HttpRespons