Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
// ========================================================================
// Resource: Amazon DynamoDB Table
// ========================================================================
// Purpose: serverless, pay as you go, persistent storage for the demo app
// See also:
// - https://aws.amazon.com/dynamodb/
// - https://docs.aws.amazon.com/cdk/api/latest/docs/aws-dynamodb-readme.html
const itemsTable = new dynamodb.Table(this, "ItemsTable", {
billingMode: BillingMode.PAY_PER_REQUEST,
serverSideEncryption: true,
stream: StreamViewType.NEW_AND_OLD_IMAGES,
partitionKey: {name: "id", type: dynamodb.AttributeType.STRING}
});
const usersTable = new dynamodb.Table(this, "UsersTable", {
billingMode: BillingMode.PAY_PER_REQUEST,
serverSideEncryption: true,
stream: StreamViewType.NEW_AND_OLD_IMAGES,
partitionKey: {name: "username", type: dynamodb.AttributeType.STRING},
timeToLiveAttribute: "ttl",
});
// ========================================================================
// Resource: AWS Lambda Function - CRUD API Backend
// ========================================================================
// Purpose: serverless backend for the demo app, uses express.js
// See also:
// - https://aws.amazon.com/dynamodb/
// - https://docs.aws.amazon.com/cdk/api/latest/docs/aws-dynamodb-readme.html
const itemsTable = new dynamodb.Table(this, "ItemsTable", {
billingMode: BillingMode.PAY_PER_REQUEST,
serverSideEncryption: true,
stream: StreamViewType.NEW_AND_OLD_IMAGES,
partitionKey: {name: "id", type: dynamodb.AttributeType.STRING}
});
const usersTable = new dynamodb.Table(this, "UsersTable", {
billingMode: BillingMode.PAY_PER_REQUEST,
serverSideEncryption: true,
stream: StreamViewType.NEW_AND_OLD_IMAGES,
partitionKey: {name: "username", type: dynamodb.AttributeType.STRING},
timeToLiveAttribute: "ttl",
});
// ========================================================================
// Resource: AWS Lambda Function - CRUD API Backend
// ========================================================================
// Purpose: serverless backend for the demo app, uses express.js
// See also:
// - https://aws.amazon.com/lambda/
// - https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-readme.html
const apiFunction = new lambda.Function(this, "APIFunction", {
runtime: nodeRuntime,