Skip to content

Commit a62435c

Browse files
committed
rename 'routes' to 'methods' to be more accurate
1 parent cef99a7 commit a62435c

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

packages/rest-api-construct/src/construct.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void describe('RestApiConstruct Lambda Handling', () => {
1313
apiProps: [
1414
{
1515
path: 'items',
16-
routes: ['GET'],
16+
methods: ['GET'],
1717
lambdaEntry: {
1818
runtime: lambda.Runtime.NODEJS_18_X,
1919
source: { path: 'packages/rest-api-construct/lib/test-assets' },
@@ -35,7 +35,7 @@ void describe('RestApiConstruct Lambda Handling', () => {
3535
apiProps: [
3636
{
3737
path: 'items',
38-
routes: ['GET'],
38+
methods: ['GET'],
3939
lambdaEntry: {
4040
runtime: lambda.Runtime.NODEJS_22_X,
4141
source: {
@@ -61,7 +61,7 @@ void describe('RestApiConstruct', () => {
6161
apiProps: [
6262
{
6363
path: '/test',
64-
routes: ['GET', 'POST'],
64+
methods: ['GET', 'POST'],
6565
lambdaEntry: {
6666
runtime: lambda.Runtime.NODEJS_18_X,
6767
source: {
@@ -71,7 +71,7 @@ void describe('RestApiConstruct', () => {
7171
},
7272
{
7373
path: '/blog',
74-
routes: ['GET', 'POST', 'PUT'],
74+
methods: ['GET', 'POST', 'PUT'],
7575
lambdaEntry: {
7676
runtime: lambda.Runtime.NODEJS_18_X,
7777
source: {

packages/rest-api-construct/src/construct.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class RestApiConstruct extends Construct {
2626

2727
// Iterate over each path configuration
2828
for (const [index, pathConfig] of Object.entries(props.apiProps)) {
29-
const { path, routes, lambdaEntry } = pathConfig;
29+
const { path, methods, lambdaEntry } = pathConfig;
3030
const source = lambdaEntry.source;
3131

3232
// Determine Lambda code source - either ExistingDirectory, NewFromCode, or ExistingLambda (function already exists in aws and does not need to be constructed)
@@ -55,7 +55,7 @@ export class RestApiConstruct extends Construct {
5555

5656
// Add resource and methods for this route
5757
const resource = this.addNestedResource(this.api.root, path);
58-
for (const method of routes) {
58+
for (const method of methods) {
5959
resource.addMethod(method, new apiGateway.LambdaIntegration(handler));
6060
}
6161
}

packages/rest-api-construct/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export type RestApiConstructProps = {
1818

1919
export type RestApiPathConfig = {
2020
path: string;
21-
routes: HttpMethod[];
21+
methods: HttpMethod[];
2222
lambdaEntry: LambdaSource;
2323
};
2424

0 commit comments

Comments
 (0)