From 65f62b75c00d6d5daf51779cc305fac21b204cf4 Mon Sep 17 00:00:00 2001 From: outersky Date: Fri, 4 Feb 2022 10:26:20 +0800 Subject: [PATCH 1/2] fix: Present should be Message Present<*> is not supported now by default --- lib/src/routes/routes.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/src/routes/routes.dart b/lib/src/routes/routes.dart index b332219..25d82ff 100644 --- a/lib/src/routes/routes.dart +++ b/lib/src/routes/routes.dart @@ -33,7 +33,8 @@ AngelConfigurer configureServer(FileSystem fileSystem) { var executor = req.container!.make()!; var message = req.bodyAsMap['message'].toString(); var query = GreetingQuery()..values.message = message; - return await query.insert(executor); + var optional = await query.insert(executor); + return optional.value; } }); From 290b018ab9a32a99690d56994bbcbbfdde315a52 Mon Sep 17 00:00:00 2001 From: outersky Date: Fri, 4 Feb 2022 10:32:26 +0800 Subject: [PATCH 2/2] fix README --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2088a61..6da72da 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ This is an ORM starter application for [Angel3 framework](https://angel3-framewo 5. Run the migration to generate `migrations` and `greetings` tables in the database. ```bash - dart bin/migration.dart + dart bin/migrate.dart up ``` ### Development @@ -43,6 +43,25 @@ This is an ORM starter application for [Angel3 framework](https://angel3-framewo 2. Modify the code and watch the changes applied to the application + +3. Insert a message into DB: + + ``` + curl -H "Content-Type: application/json" -X POST -d '{"message":"OK_Message" }' "http://localhost:3000/greetings/" + ``` + + or + + ``` + curl -X POST -d 'message=OK_Message2' "http://localhost:3000/greetings/" + ``` + +4. Query DB: + + ``` + http://localhost:3000/greetings/ + ``` + ### Production 1. Run the following command: