From 5f8369e66fca36406e343ef628b48ff83e1042f9 Mon Sep 17 00:00:00 2001 From: regiostech Date: Thu, 3 Mar 2016 23:35:59 -0500 Subject: [PATCH] Modified README --- .gitignore | 5 ++++- README.md | 3 ++- lib/body_parser.dart | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b306bf88..172a6cef 100644 --- a/.gitignore +++ b/.gitignore @@ -49,8 +49,9 @@ atlassian-ide-plugin.xml com_crashlytics_export_strings.xml crashlytics.properties crashlytics-build.properties + ### Dart template -# Don’t commit the following directories created by pub. +# Don't commit the following directories created by pub. .buildlog .pub/ build/ @@ -66,3 +67,5 @@ packages # Include when developing application packages. pubspec.lock +doc/api + diff --git a/README.md b/README.md index 02b1cda1..3723597c 100644 --- a/README.md +++ b/README.md @@ -49,11 +49,12 @@ main() async { } ``` +You can also use `buildMapFromUri(Map, String)` to populate a map from a URL encoded string. + This can easily be used with a library like [JSON God](https://github.com/thosakwe/json_god) to build structured JSON/REST APIs. Add validation and you've got an instant backend. ```dart - MyClass create(HttpRequest request) async { God god = new God(); return god.deserialize(await parseBody(request).body, MyClass); diff --git a/lib/body_parser.dart b/lib/body_parser.dart index 5a0902f1..80e2914c 100644 --- a/lib/body_parser.dart +++ b/lib/body_parser.dart @@ -44,6 +44,8 @@ Future parseBody(HttpRequest request) async { } /// Parses a URI-encoded string into real data! **Wow!** +/// +/// Whichever map you provide will be automatically populated from the urlencoded body string you provide. buildMapFromUri(Map map, String body) { God god = new God(); for (String keyValuePair in body.split('&')) {