Skip to content

Commit 6fffff0

Browse files
committed
fixing complete get a listing query
1 parent 74efd91 commit 6fffff0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/content/complete-get-a-listing-query.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ chapter: Get A Listing Query
88
postnumber: 14
99
---
1010

11-
Now lets do what we did in the previous query and lets start in the Query.js file and add the following:
11+
Now lets do what we did in the previous query and lets start in the `Query.js` file and add the following:
1212

1313
```javascript
1414
const params = {
@@ -20,20 +20,18 @@ const params = {
2020
}
2121
```
2222

23-
🍕In this params object we are using a FilterExpression to get the specific listing from the table, which is the listingId in our case.
23+
🍕In this params object we are using a `FilterExpression` to get the specific listing from the table, which is the `listingId` in our case.
2424

25-
🍕The ExpressionAttributesValues object is where we need assign a value to the property we declared in the FilterExpression.
25+
🍕The `ExpressionAttributesValues` object is where we need to assign a value to the property we declared in the `FilterExpression`.
2626

27-
🍕 args is short for the arguments we take in from query.
27+
🍕 `args` is short for the arguments we take in from query, in this case we are taking in the `listingId`.
2828

29-
Next we can start sending these params to Dynamo and return the selected listing:
29+
Next we can start sending these params to DynamoDB and return the selected listing:
3030

3131
```javascript
3232
try {
3333
const listing = await dynamoDBLib.call("scan", params)
3434

35-
console.log(listing)
36-
3735
if (listing.Items.length === 0) {
3836
return "There is no listing"
3937
} else {
@@ -65,7 +63,7 @@ try {
6563
} catch (e) {
6664
return {
6765
message: e.message,
68-
code: "500x",
66+
code: "500",
6967
}
7068
}
7169
```

0 commit comments

Comments
 (0)