We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 648a14c commit f2e0f03Copy full SHA for f2e0f03
todos/routes.js
@@ -57,7 +57,24 @@ router
57
router
58
.route("/todos/:id")
59
.get(function get(req, res) {
60
- res.send("get");
+ const params = Object.assign({}, tableParams, {
61
+ Key: {
62
+ id: req.params.id
63
+ }
64
+ });
65
+
66
+ dynamoDb.get(params, (error, result) => {
67
+ if (error) {
68
+ console.error(error);
69
+ res.status(400).send({ error: "Could not get todo item" });
70
71
72
+ if (result.Item) {
73
+ res.json(result.Item);
74
+ } else {
75
+ res.status(400).send({ error: "Item not found" });
76
77
78
})
79
.put(function update(req, res) {
80
res.send("update");
0 commit comments