Merge pull request #219 from dart-lang/mit-mit-example

Add a small example
diff --git a/example/main.dart b/example/main.dart
new file mode 100644
index 0000000..1cabc5c
--- /dev/null
+++ b/example/main.dart
@@ -0,0 +1,18 @@
+import 'dart:convert' as convert;
+import 'package:http/http.dart' as http;
+
+main(List<String> arguments) async {
+  // This example uses the Google Books API to search for books about http.
+  // https://developers.google.com/books/docs/overview
+  var url = "https://www.googleapis.com/books/v1/volumes?q={http}";
+
+  // Await the http get response, then decode the json-formatted responce.
+  var response = await http.get(url);
+  if (response.statusCode == 200) {
+    var jsonResponse = convert.jsonDecode(response.body);
+    var itemCount = jsonResponse['totalItems'];
+    print("Number of books about http: $itemCount.");
+  } else {
+    print("Request failed with status: ${response.statusCode}.");
+  }
+}