How did you define your table? It sounds like you did not specify
post
as a primary key for this table.
s
swift-painter-31084
06/25/2019, 9:17 PM
```
const postsTable = new cloud.Table( 'feedPosts', 'postId' );
// Create an API endpoint
const endpoint = new cloud.API( 'feed-posts' );
// Add a new Feed Post
endpoint.post( '/posts/add', ( req, res ) => {
const feedPost = JSON.parse( req.body );
console.log( feedPost );
postsTable.insert( {
postId: feedPost.postId,
title: feedPost.title,
body: feedPost.body,
} ).then( () => { res.status( 200 ).json( feedPost ); },
res.status( 500 ).end() );
} );
// Get a single Feed Post
endpoint.get( '/posts/{postId}', ( req, res ) => {
const post = req.params.postId;
console.log( post );
postsTable.get( { post } ).then( ( value ) => {
res.status( 200 ).json( value );
} );
} );
swift-painter-31084
06/25/2019, 9:18 PM
That was my code; after your message I updated my get to use postId for the assignment to the parameter and passed that into the query, that worked fine.
swift-painter-31084
06/25/2019, 9:19 PM
I guess the table.get {query} is looking at the key name itself, not assuming the value is the primary key.
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.