Merge pull request #1 from outersky/angel3-orm

fix: Present<Message> should be Message
This commit is contained in:
Thomas Hii 2022-02-11 23:22:38 +08:00 committed by GitHub
commit b5fea5806d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 2 deletions

View file

@ -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:

View file

@ -33,7 +33,8 @@ AngelConfigurer configureServer(FileSystem fileSystem) {
var executor = req.container!.make<QueryExecutor>()!;
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;
}
});