diff --git a/docs/constructs/assets/icons.js b/docs/constructs/assets/icons.js
index 58882d7..3ae8f55 100644
--- a/docs/constructs/assets/icons.js
+++ b/docs/constructs/assets/icons.js
@@ -3,7 +3,7 @@
function addIcons() {
if (document.readyState === "loading") return document.addEventListener("DOMContentLoaded", addIcons);
const svg = document.body.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg"));
- svg.innerHTML = `
CDK Serverless is a powerful toolkit designed to simplify serverless application development using the AWS Cloud Development Kit (CDK). It offers project management features, higher-level (L3) constructs, and utility libraries to streamline the creation and management of serverless architectures. Additionally, it leverages utility libraries to write Lambda functions and do live updates to Lambda function code during development.
Video introduction: https://www.youtube.com/watch?v=xhNJ0cXG3O8
-To begin a new project with CDK Serverless:
+To begin a new project with CDK Serverless:
Create a new CDK TypeScript app using projen:
$ npx projen new awscdk-app-ts
@@ -23,29 +26,39 @@ npx projen to install it
Now you can use the project type ServerlessProject for your app.
First you need to add the desired construct to your projen configuration: (e.g. RestApi)
+First you need to add the desired construct to your projen configuration: (e.g. RestApi)
import { RestApi } from 'cdk-serverless/projen';
new RestApi(project, {
apiName: 'TestApi', // logical name of your API
definitionFile: 'testapi.yaml', // path to your OpenAPI spec
});
Then run projen to generate construct files and models for the API.
-In your stack you can then reference the generated L3s to create the API:
+In your stack you can then reference the generated L3s to create the API:
import { TestApiRestApi } from './generated/rest.testapi-api.generated';
const api = new TestApiRestApi(this, 'Api', {
stageName: props.stageName,
domainName: props.domainName,
apiHostname: 'api',
singleTableDatastore,
cors: true,
additionalEnv: {
DOMAIN_NAME: props.domainName,
},
});
This will also create Lambda functions for all operations defined in your spec and wire them accordingly.
-CDK Serverless provides two powerful test utilities to help you write comprehensive tests for your serverless applications.
-The LambdaTestUtil provides classes for testing both REST and GraphQL Lambda functions in isolation. It's perfect for unit testing your Lambda handlers.
import { LambdaRestUnitTest } from 'cdk-serverless/tests/lambda-test-utils';
const test = new LambdaRestUnitTest(handler, {
// Optional default headers for all requests
headers: {
'Content-Type': 'application/json',
},
// Optional default Cognito user for all requests
cognito: {
username: 'test-user',
email: 'test@example.com',
groups: ['admin'],
},
});
// Test a GET request
const result = await test.call({
path: '/items',
method: 'GET',
});
// Test a POST request with body
const result = await test.call({
path: '/items',
method: 'POST',
body: JSON.stringify({ name: 'test' }),
});
+Testing Utilities
+CDK Serverless provides two powerful test utilities to help you write comprehensive tests for your serverless applications.
+LambdaTestUtil
+The LambdaTestUtil provides classes for testing both REST and GraphQL Lambda functions in isolation. It's perfect for unit testing your Lambda handlers.
+REST API Testing
+import { LambdaRestUnitTest } from 'cdk-serverless/tests/lambda-test-utils';
const test = new LambdaRestUnitTest(handler, {
// Optional default headers for all requests
headers: {
'Content-Type': 'application/json',
},
// Optional default Cognito user for all requests
cognito: {
username: 'test-user',
email: 'test@example.com',
groups: ['admin'],
},
});
// Test a GET request
const result = await test.call({
path: '/items',
method: 'GET',
});
// Test a POST request with body
const result = await test.call({
path: '/items',
method: 'POST',
body: JSON.stringify({ name: 'test' }),
});
-GraphQL Testing
import { LambdaGraphQLTest } from 'cdk-serverless/tests/lambda-test-utils';
const test = new LambdaGraphQLTest(handler, {
// Optional default Cognito user for all requests
cognito: {
username: 'test-user',
email: 'test@example.com',
groups: ['admin'],
},
});
// Test a GraphQL query
const result = await test.call({
fieldName: 'getItem',
arguments: { id: '123' },
});
+GraphQL Testing
+import { LambdaGraphQLTest } from 'cdk-serverless/tests/lambda-test-utils';
const test = new LambdaGraphQLTest(handler, {
// Optional default Cognito user for all requests
cognito: {
username: 'test-user',
email: 'test@example.com',
groups: ['admin'],
},
});
// Test a GraphQL query
const result = await test.call({
fieldName: 'getItem',
arguments: { id: '123' },
});
-IntegTestUtil
The IntegTestUtil provides a comprehensive set of tools for integration testing your deployed serverless applications. It handles authentication, data cleanup, and API testing.
+IntegTestUtil
+The IntegTestUtil provides a comprehensive set of tools for integration testing your deployed serverless applications. It handles authentication, data cleanup, and API testing.
import { IntegTestUtil } from 'cdk-serverless/tests/integ-test-util';
// Initialize with your stack outputs
const test = new IntegTestUtil({
region: 'us-east-1',
apiOptions: {
baseURL: 'https://api.example.com',
},
authOptions: {
userPoolId: 'us-east-1_xxxxx',
userPoolClientId: 'xxxxxxxx',
identityPoolId: 'us-east-1:xxxxxxxx',
},
datastoreOptions: {
tableName: 'MyTable',
},
});
// Create and authenticate a test user
await test.createUser('test@example.com', {
'custom:attribute': 'value',
}, ['admin']);
// Get an authenticated API client
const client = await test.getAuthenticatedClient('test@example.com');
// Make API calls
const response = await client.get('/items');
// Clean up test data
await test.cleanupItems();
await test.removeUser('test@example.com');
-Contribute
How to contribute to CDK Serverless
Did you find a bug?
+Contribute
+How to contribute to CDK Serverless
+Did you find a bug?
+
-
Ensure the bug was not already reported by searching on GitHub under Issues.
@@ -53,7 +66,8 @@ ContributeIf you're unable to find an open issue addressing the problem, open a new one. Be sure to include a title and clear description, as much relevant information as possible, and a code sample or an executable test case demonstrating the expected behavior that is not occurring.
-Did you write a patch that fixes a bug?
+Did you write a patch that fixes a bug?
+
-
Open a new GitHub pull request with the patch.
@@ -61,8 +75,10 @@
Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
-Did you fix whitespace, format code, or make a purely cosmetic patch?
Changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability will normally not be accepted.
-Do you intend to add a new feature or change an existing one?
CDK Serverless is a powerful toolkit designed to simplify serverless application development using the AWS Cloud Development Kit (CDK). It offers project management features, higher-level (L3) constructs, and utility libraries to streamline the creation and management of serverless architectures. Additionally, it leverages utility libraries to write Lambda functions and do live updates to Lambda function code during development.
Video introduction: https://www.youtube.com/watch?v=xhNJ0cXG3O8
-To begin a new project with CDK Serverless:
+To begin a new project with CDK Serverless:
Create a new CDK TypeScript app using projen:
$ npx projen new awscdk-app-ts
@@ -23,29 +26,39 @@ npx projen to install it
Now you can use the project type ServerlessProject for your app.
First you need to add the desired construct to your projen configuration: (e.g. RestApi)
+First you need to add the desired construct to your projen configuration: (e.g. RestApi)
import { RestApi } from 'cdk-serverless/projen';
new RestApi(project, {
apiName: 'TestApi', // logical name of your API
definitionFile: 'testapi.yaml', // path to your OpenAPI spec
});
Then run projen to generate construct files and models for the API.
-In your stack you can then reference the generated L3s to create the API:
+In your stack you can then reference the generated L3s to create the API:
import { TestApiRestApi } from './generated/rest.testapi-api.generated';
const api = new TestApiRestApi(this, 'Api', {
stageName: props.stageName,
domainName: props.domainName,
apiHostname: 'api',
singleTableDatastore,
cors: true,
additionalEnv: {
DOMAIN_NAME: props.domainName,
},
});
This will also create Lambda functions for all operations defined in your spec and wire them accordingly.
-CDK Serverless provides two powerful test utilities to help you write comprehensive tests for your serverless applications.
-The LambdaTestUtil provides classes for testing both REST and GraphQL Lambda functions in isolation. It's perfect for unit testing your Lambda handlers.
import { LambdaRestUnitTest } from 'cdk-serverless/tests/lambda-test-utils';
const test = new LambdaRestUnitTest(handler, {
// Optional default headers for all requests
headers: {
'Content-Type': 'application/json',
},
// Optional default Cognito user for all requests
cognito: {
username: 'test-user',
email: 'test@example.com',
groups: ['admin'],
},
});
// Test a GET request
const result = await test.call({
path: '/items',
method: 'GET',
});
// Test a POST request with body
const result = await test.call({
path: '/items',
method: 'POST',
body: JSON.stringify({ name: 'test' }),
});
+Testing Utilities
+CDK Serverless provides two powerful test utilities to help you write comprehensive tests for your serverless applications.
+LambdaTestUtil
+The LambdaTestUtil provides classes for testing both REST and GraphQL Lambda functions in isolation. It's perfect for unit testing your Lambda handlers.
+REST API Testing
+import { LambdaRestUnitTest } from 'cdk-serverless/tests/lambda-test-utils';
const test = new LambdaRestUnitTest(handler, {
// Optional default headers for all requests
headers: {
'Content-Type': 'application/json',
},
// Optional default Cognito user for all requests
cognito: {
username: 'test-user',
email: 'test@example.com',
groups: ['admin'],
},
});
// Test a GET request
const result = await test.call({
path: '/items',
method: 'GET',
});
// Test a POST request with body
const result = await test.call({
path: '/items',
method: 'POST',
body: JSON.stringify({ name: 'test' }),
});
-GraphQL Testing
import { LambdaGraphQLTest } from 'cdk-serverless/tests/lambda-test-utils';
const test = new LambdaGraphQLTest(handler, {
// Optional default Cognito user for all requests
cognito: {
username: 'test-user',
email: 'test@example.com',
groups: ['admin'],
},
});
// Test a GraphQL query
const result = await test.call({
fieldName: 'getItem',
arguments: { id: '123' },
});
+GraphQL Testing
+import { LambdaGraphQLTest } from 'cdk-serverless/tests/lambda-test-utils';
const test = new LambdaGraphQLTest(handler, {
// Optional default Cognito user for all requests
cognito: {
username: 'test-user',
email: 'test@example.com',
groups: ['admin'],
},
});
// Test a GraphQL query
const result = await test.call({
fieldName: 'getItem',
arguments: { id: '123' },
});
-IntegTestUtil
The IntegTestUtil provides a comprehensive set of tools for integration testing your deployed serverless applications. It handles authentication, data cleanup, and API testing.
+IntegTestUtil
+The IntegTestUtil provides a comprehensive set of tools for integration testing your deployed serverless applications. It handles authentication, data cleanup, and API testing.
import { IntegTestUtil } from 'cdk-serverless/tests/integ-test-util';
// Initialize with your stack outputs
const test = new IntegTestUtil({
region: 'us-east-1',
apiOptions: {
baseURL: 'https://api.example.com',
},
authOptions: {
userPoolId: 'us-east-1_xxxxx',
userPoolClientId: 'xxxxxxxx',
identityPoolId: 'us-east-1:xxxxxxxx',
},
datastoreOptions: {
tableName: 'MyTable',
},
});
// Create and authenticate a test user
await test.createUser('test@example.com', {
'custom:attribute': 'value',
}, ['admin']);
// Get an authenticated API client
const client = await test.getAuthenticatedClient('test@example.com');
// Make API calls
const response = await client.get('/items');
// Clean up test data
await test.cleanupItems();
await test.removeUser('test@example.com');
-Contribute
How to contribute to CDK Serverless
Did you find a bug?
+Contribute
+How to contribute to CDK Serverless
+Did you find a bug?
+
-
Ensure the bug was not already reported by searching on GitHub under Issues.
@@ -53,7 +66,8 @@ ContributeIf you're unable to find an open issue addressing the problem, open a new one. Be sure to include a title and clear description, as much relevant information as possible, and a code sample or an executable test case demonstrating the expected behavior that is not occurring.
-Did you write a patch that fixes a bug?
+Did you write a patch that fixes a bug?
+
-
Open a new GitHub pull request with the patch.
@@ -61,8 +75,10 @@
Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
-Did you fix whitespace, format code, or make a purely cosmetic patch?
Changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability will normally not be accepted.
-Do you intend to add a new feature or change an existing one?
CDK Serverless is a powerful toolkit designed to simplify serverless application development using the AWS Cloud Development Kit (CDK). It offers project management features, higher-level (L3) constructs, and utility libraries to streamline the creation and management of serverless architectures. Additionally, it leverages utility libraries to write Lambda functions and do live updates to Lambda function code during development.
Video introduction: https://www.youtube.com/watch?v=xhNJ0cXG3O8
-To begin a new project with CDK Serverless:
+To begin a new project with CDK Serverless:
Create a new CDK TypeScript app using projen:
$ npx projen new awscdk-app-ts
@@ -23,29 +26,39 @@ npx projen to install it
Now you can use the project type ServerlessProject for your app.
First you need to add the desired construct to your projen configuration: (e.g. RestApi)
+First you need to add the desired construct to your projen configuration: (e.g. RestApi)
import { RestApi } from 'cdk-serverless/projen';
new RestApi(project, {
apiName: 'TestApi', // logical name of your API
definitionFile: 'testapi.yaml', // path to your OpenAPI spec
});
Then run projen to generate construct files and models for the API.
-In your stack you can then reference the generated L3s to create the API:
+In your stack you can then reference the generated L3s to create the API:
import { TestApiRestApi } from './generated/rest.testapi-api.generated';
const api = new TestApiRestApi(this, 'Api', {
stageName: props.stageName,
domainName: props.domainName,
apiHostname: 'api',
singleTableDatastore,
cors: true,
additionalEnv: {
DOMAIN_NAME: props.domainName,
},
});
This will also create Lambda functions for all operations defined in your spec and wire them accordingly.
-CDK Serverless provides two powerful test utilities to help you write comprehensive tests for your serverless applications.
-The LambdaTestUtil provides classes for testing both REST and GraphQL Lambda functions in isolation. It's perfect for unit testing your Lambda handlers.
import { LambdaRestUnitTest } from 'cdk-serverless/tests/lambda-test-utils';
const test = new LambdaRestUnitTest(handler, {
// Optional default headers for all requests
headers: {
'Content-Type': 'application/json',
},
// Optional default Cognito user for all requests
cognito: {
username: 'test-user',
email: 'test@example.com',
groups: ['admin'],
},
});
// Test a GET request
const result = await test.call({
path: '/items',
method: 'GET',
});
// Test a POST request with body
const result = await test.call({
path: '/items',
method: 'POST',
body: JSON.stringify({ name: 'test' }),
});
+Testing Utilities
+CDK Serverless provides two powerful test utilities to help you write comprehensive tests for your serverless applications.
+LambdaTestUtil
+The LambdaTestUtil provides classes for testing both REST and GraphQL Lambda functions in isolation. It's perfect for unit testing your Lambda handlers.
+REST API Testing
+import { LambdaRestUnitTest } from 'cdk-serverless/tests/lambda-test-utils';
const test = new LambdaRestUnitTest(handler, {
// Optional default headers for all requests
headers: {
'Content-Type': 'application/json',
},
// Optional default Cognito user for all requests
cognito: {
username: 'test-user',
email: 'test@example.com',
groups: ['admin'],
},
});
// Test a GET request
const result = await test.call({
path: '/items',
method: 'GET',
});
// Test a POST request with body
const result = await test.call({
path: '/items',
method: 'POST',
body: JSON.stringify({ name: 'test' }),
});
-GraphQL Testing
import { LambdaGraphQLTest } from 'cdk-serverless/tests/lambda-test-utils';
const test = new LambdaGraphQLTest(handler, {
// Optional default Cognito user for all requests
cognito: {
username: 'test-user',
email: 'test@example.com',
groups: ['admin'],
},
});
// Test a GraphQL query
const result = await test.call({
fieldName: 'getItem',
arguments: { id: '123' },
});
+GraphQL Testing
+import { LambdaGraphQLTest } from 'cdk-serverless/tests/lambda-test-utils';
const test = new LambdaGraphQLTest(handler, {
// Optional default Cognito user for all requests
cognito: {
username: 'test-user',
email: 'test@example.com',
groups: ['admin'],
},
});
// Test a GraphQL query
const result = await test.call({
fieldName: 'getItem',
arguments: { id: '123' },
});
-IntegTestUtil
The IntegTestUtil provides a comprehensive set of tools for integration testing your deployed serverless applications. It handles authentication, data cleanup, and API testing.
+IntegTestUtil
+The IntegTestUtil provides a comprehensive set of tools for integration testing your deployed serverless applications. It handles authentication, data cleanup, and API testing.
import { IntegTestUtil } from 'cdk-serverless/tests/integ-test-util';
// Initialize with your stack outputs
const test = new IntegTestUtil({
region: 'us-east-1',
apiOptions: {
baseURL: 'https://api.example.com',
},
authOptions: {
userPoolId: 'us-east-1_xxxxx',
userPoolClientId: 'xxxxxxxx',
identityPoolId: 'us-east-1:xxxxxxxx',
},
datastoreOptions: {
tableName: 'MyTable',
},
});
// Create and authenticate a test user
await test.createUser('test@example.com', {
'custom:attribute': 'value',
}, ['admin']);
// Get an authenticated API client
const client = await test.getAuthenticatedClient('test@example.com');
// Make API calls
const response = await client.get('/items');
// Clean up test data
await test.cleanupItems();
await test.removeUser('test@example.com');
-Contribute
How to contribute to CDK Serverless
Did you find a bug?
+Contribute
+How to contribute to CDK Serverless
+Did you find a bug?
+
-
Ensure the bug was not already reported by searching on GitHub under Issues.
@@ -53,7 +66,8 @@ ContributeIf you're unable to find an open issue addressing the problem, open a new one. Be sure to include a title and clear description, as much relevant information as possible, and a code sample or an executable test case demonstrating the expected behavior that is not occurring.
-Did you write a patch that fixes a bug?
+Did you write a patch that fixes a bug?
+
-
Open a new GitHub pull request with the patch.
@@ -61,8 +75,10 @@
Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
-Did you fix whitespace, format code, or make a purely cosmetic patch?
Changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability will normally not be accepted.
-Do you intend to add a new feature or change an existing one?