anchor.diff:  final PORT = 8080;
   
   void main() {
  -  var server = new HttpServer();
  +  var apiHandler = new ApiHandler();
  +  var staticHandler = new StaticHandler("example");
   
  -  var static = new StaticHandler("example");
  -  server.defaultRequestHandler = static.onRequest;
  -
  -  var api = new ApiHandler();
  -  server.addRequestHandler(api.match, api.onRequest);
  -
  -  server.listen(HOST, PORT); 
  +  HttpServer.bind(HOST, PORT).then((server){
  +    server.listen((req){
  +      var handler = apiHandler.match(req) ? apiHandler : staticHandler;
  +      handler.onRequest(req, req.response);
  +    });
  +  });
   }
   
   class ApiHandler {
  -  bool match(request) => request.uri.startsWith("/api");
  +  bool match(request) => request.uri.toString().startsWith("/api");
     
     void onRequest(request, response) {
  -    var uri = request.uri;
  +    var uri = request.uri.toString();
       var method = request.method;
   
       print("REQUEST: ${method} ${uri}");
         
       if (uri.startsWith("/api/tasks") && method == "GET"){
  -      _render("text/json", _items(), response);
  +      _renderItems(response);
   
       } else if (uri.startsWith("/api/tasks") && method == "POST"){
         _renderNewRecord(request, response);
  
positive.code:       _renderUpdatedRecord(request, response);
      }
    }
    
    _renderNewRecord(request, response){
      var s = new StringInputStream(request.inputStream);
      s.onData = (){
        var data = s.read();
        print("body: ${data}");
        
        var map = json.parse(data);
        map["id"] = new Random().nextInt(10000);
        _render("text/json", json.stringify(map), response);
      };    
    }
  
    _renderUpdatedRecord(request, response){
      var s = new StringInputStream(request.inputStream);
      s.onData = (){
        var data = s.read();
        print("BODY: ${data}");
        _render("text/json", data, response);
      };
    }
  
    _render(contentType, body, response){
      response.headers.set(HttpHeaders.CONTENT_TYPE, "$contentType; charset=UTF-8");
      response.outputStream.writeString(body);
      response.outputStream.close();
    }
  
    _items() {
      var r = [
          {"id": 1, "text": "Task 1", "status" : "inProgress"},
          {"id": 2, "text": "Task 2", "status" : "inProgress"}
      ];
      return json.stringify(r);
    }
  }
  
  
negative.code:   StaticHandler(this.folder);
  
    onRequest(request, response) {
      var path = request.uri.toString();
      var file = new File('${folder}${path}');
      print('${folder}${path}');
  
      file.exists().then((exists){
        if(exists){
          file.openRead().pipe(response);
        } else {
          response.close();
        }
      });
    }
  