我正在研究小型 React Native 项目。我确实使用了 MobileHub 并创建了简单的 Logs 表(我正在关注该教程:https ://docs.aws.amazon.com/aws-mobile/latest/developerguide/react-native-access-databases.html )。
Path to be used on API for get and remove an object should be like:
/Logs/object/:LogID/:LogKey
Path to be used on API for list objects on get method should be like:
/Logs/:LogID
JSON to be used as data on put request should be like:
{
"LogValue": "INSERT VALUE HERE",
"LogTime": "INSERT VALUE HERE",
"LogID": "INSERT VALUE HERE",
"LogKey": "INSERT VALUE HERE"
}
To test the api from the command line (after awsmobile push) use this commands
awsmobile cloud-api invoke LogsCRUD <method> <path> [init]
我可以在数据库中插入任何内容(使用:API.put('LogsCRUD', '/Logs', data),或获取单个项目(API.get('LogsCRUD', '/Logs/1')) ,但我找不到任何想法如何从表中获取所有项目。我检查了很多东西,并试图通过随机名称来弄清楚,但没有任何效果。