![nodejs local dynamodb nodejs local dynamodb](https://raw.githubusercontent.com/pluralsight/guides/master/images/2965d6f2-9e6b-4a3c-855e-97eef7f22c43.png)
Run the function and return your responseĪnd, there you have it.
NODEJS LOCAL DYNAMODB UPDATE
Extract the new value you'd like to update from the event body, and pass it in as an argument to the dynamoDB update function.
![nodejs local dynamodb nodejs local dynamodb](https://keyholesoftware.com/wp-content/uploads/Serverless-1.png)
Handle the "OPTIONS" httpMethod request.
NODEJS LOCAL DYNAMODB CODE
If you read the comments, you should see an explanation for what each bit of code means, but in case you didn't here's what we're doing: let response = Įnter fullscreen mode Exit fullscreen mode body ) // Ideally you will be passing though the item data you would like to update through the event body. log ( " event: ", event ) // It's always a good idea to log the event so you can see what data you're working with and what is being passed through const body = JSON. proxy // This is assuming you're extracting the itemId you would like to update from a proxy under the resource. Once you've navigated to the amplify directory within your terminal, you can run the amplify command:Ĭonst itemId = event. If you haven't yet done so, check out the npm packages AWS Amplify Package, aws-amplify/ui-react, and aws-sdk. This directory should have been created with you initiating your amplify project. This example will be assuming you're working with an established AWS Amplify NextJS project with your environment already configured.ġ.To begin creating your update function, navigate to your amplify directory in your current project.
NODEJS LOCAL DYNAMODB HOW TO
How to Write a NodeJS Function to Update a DynamoDB Item using AWS Lambda and Amplify CLI ?️