Skip to content

Instantly share code, notes, and snippets.

@travispbrown
Last active December 13, 2015 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save travispbrown/4957228 to your computer and use it in GitHub Desktop.
Save travispbrown/4957228 to your computer and use it in GitHub Desktop.
Short example of node.js Express method to POST resource data into DynamoDB. This was just a snippet for my blog to illustrate the type of transformation DynamoDB requires. Assume the data has already been validated, and DynamoDB connection established.
resource.post (req, res) ->
params =
TableName: 'TableName'
Item:
'id':
S: req.body.id
'color':
S: req.body.color
'tags':
SS: req.body.tags
'count':
N: req.body.count
ddb.client.putItem params, (error, data) ->
if !error?
res.end 201
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment