File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ chapter: Get A Listing Query
88postnumber : 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
1414const 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
3232try {
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 {
6563} catch (e) {
6664 return {
6765 message: e .message ,
68- code: " 500x " ,
66+ code: " 500 " ,
6967 }
7068}
7169```
You can’t perform that action at this time.
0 commit comments