Last active
April 13, 2021 23:02
-
-
Save omerucel/a741fd0dca41f5156c8d3742b05ad411 to your computer and use it in GitHub Desktop.
Create User - DynamoDB Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require("aws-sdk"); | |
const dbClient = new AWS.DynamoDB.DocumentClient({apiVersion: '2012-08-10'}); | |
exports.handler = async (event) => { | |
let params = JSON.parse(event.body); | |
await dbClient.put({ | |
TableName: 'users', | |
Item: { | |
email: params.email, | |
name: params.name | |
} | |
}).promise(); | |
return { | |
statusCode: 200, | |
body: JSON.stringify({}) | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment