Skip to content

Commit 2d6fbc9

Browse files
committed
Use env variables for dynamic table names
1 parent 50f405d commit 2d6fbc9

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

aws-node-rest-api-with-dynamodb/todos/create.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports.create = (event, context, callback) => {
1515
}
1616

1717
const params = {
18-
TableName: 'todos',
18+
TableName: process.env.DYNAMODB_TABLE,
1919
Item: {
2020
id: uuid.v1(),
2121
text: data.text,

aws-node-rest-api-with-dynamodb/todos/delete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const dynamoDb = new AWS.DynamoDB.DocumentClient();
66

77
module.exports.delete = (event, context, callback) => {
88
const params = {
9-
TableName: 'todos',
9+
TableName: process.env.DYNAMODB_TABLE,
1010
Key: {
1111
id: event.pathParameters.id,
1212
},

aws-node-rest-api-with-dynamodb/todos/get.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const dynamoDb = new AWS.DynamoDB.DocumentClient();
66

77
module.exports.get = (event, context, callback) => {
88
const params = {
9-
TableName: 'todos',
9+
TableName: process.env.DYNAMODB_TABLE,
1010
Key: {
1111
id: event.pathParameters.id,
1212
},

aws-node-rest-api-with-dynamodb/todos/list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const AWS = require('aws-sdk');
44

55
const dynamoDb = new AWS.DynamoDB.DocumentClient();
66
const params = {
7-
TableName: 'todos',
7+
TableName: process.env.DYNAMODB_TABLE,
88
};
99

1010
module.exports.list = (event, context, callback) => {

aws-node-rest-api-with-dynamodb/todos/update.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports.update = (event, context, callback) => {
1616
}
1717

1818
const params = {
19-
TableName: 'todos',
19+
TableName: process.env.DYNAMODB_TABLE,
2020
Key: {
2121
id: event.pathParameters.id,
2222
},

0 commit comments

Comments
 (0)