Skip to content

Instantly share code, notes, and snippets.

@omerucel
Last active April 13, 2021 23:02
Show Gist options
  • Save omerucel/a741fd0dca41f5156c8d3742b05ad411 to your computer and use it in GitHub Desktop.
Save omerucel/a741fd0dca41f5156c8d3742b05ad411 to your computer and use it in GitHub Desktop.
Create User - DynamoDB Example
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