This Api has following methods to query,scan and put item into a DynamoDB Table
-
/getone/{mid} (GET)
-
/getall (GET)
-
/addone (POST)
{"Mid":"","Make":"","Model":"","year":0}
-
DynamoDB Table
{"Mid":"","Make":"","Model":"","year":0} -
IAM role to call DynamoDb
1)Clone this Repo
2)Export the AWS access keys
3)Run
go run main.go
4)Run curl commands to Play
➜curl http://localhost:9898/getone/1
{"Mid":"","Make":"","Model":"","year":0}
➜ curl http://localhost:9898/getone/1
{"Mid":"1","Make":"Apple","Model":"11 Max Pro","year":2020}
➜ curl http://localhost:9898/getall
[{"Mid":"1","Make":"Apple","Model":"11 Max Pro","year":2020}]
➜ curl -X POST http://localhost:9898/addone -d '{"Mid":"2","Make":"Apple", "Model":"X","year":2017}'
{"Mid":"2","Make":"Apple","Model":"X","year":2017}
➜ curl http://localhost:9898/getall
[{"Mid":"2","Make":"Apple","Model":"X","year":2017},{"Mid":"1","Make":"Apple","Model":"11 Max Pro","year":2020}]