This is an example of a Next.js application using DynamoDB for creating, updating, and deleting documents.
Option 1: Use an existing table.
Retrieve your existing access key, secret key, region and table name. Provide those values after clicking "Deploy" to automatically set the environment variables.
Option 2: Create a new table.
AmazonDynamoDBFullAccess
id
and type String
(the sort key is optional)..env.local
file similar to .env.local.example
..env.local
.yarn dev
to start the Next app at localhost:3000
.curl -X PUT http://localhost:3000/api/item -d '{"content": "test"}' -H "Content-type: application/json"
curl http://localhost:3000/api/item\?id\=bdc38386-2b35-47a3-bdfc-8ee29bd0686f
curl -X POST http://localhost:3000/api/item -d '{"content": "updated", "id": "bdc38386-2b35-47a3-bdfc-8ee29bd0686f"}' -H "Content-type: application/json"
curl -X DELETE http://localhost:3000/api/item\?id\=bdc38386-2b35-47a3-bdfc-8ee29bd0686f
Use AWS DynamoDB with Next.js API Routes.
This is an example of a Next.js application using DynamoDB for creating, updating, and deleting documents.
Option 1: Use an existing table.
Retrieve your existing access key, secret key, region and table name. Provide those values after clicking "Deploy" to automatically set the environment variables.
Option 2: Create a new table.
AmazonDynamoDBFullAccess
id
and type String
(the sort key is optional)..env.local
file similar to .env.local.example
..env.local
.yarn dev
to start the Next app at localhost:3000
.curl -X PUT http://localhost:3000/api/item -d '{"content": "test"}' -H "Content-type: application/json"
curl http://localhost:3000/api/item\?id\=bdc38386-2b35-47a3-bdfc-8ee29bd0686f
curl -X POST http://localhost:3000/api/item -d '{"content": "updated", "id": "bdc38386-2b35-47a3-bdfc-8ee29bd0686f"}' -H "Content-type: application/json"
curl -X DELETE http://localhost:3000/api/item\?id\=bdc38386-2b35-47a3-bdfc-8ee29bd0686f