Skip to content

Commit

Permalink
fix: cdk
Browse files Browse the repository at this point in the history
  • Loading branch information
apalchys committed Nov 27, 2023
1 parent e9d0028 commit 4f31b57
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions src/cdk/AngularCourseStack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,94 +9,95 @@ import { Construct } from "constructs";
import { CfnOutput } from "aws-cdk-lib";
import { NodejsFunction } from "aws-cdk-lib/aws-lambda-nodejs";
import { Runtime } from "aws-cdk-lib/aws-lambda";
import { HttpMethod } from "@aws-cdk/aws-apigatewayv2-alpha";

type Props = cdk.StackProps & {
certificateArn: string;
};

const angularTaskApi: {
path: string;
method: string;
method: HttpMethod;
lambdaName: string;
}[] = [
{
path: "/login",
method: "POST",
method: HttpMethod.POST,
lambdaName: "login",
},
{
path: "/logout",
method: "DELETE",
method: HttpMethod.DELETE,
lambdaName: "logout",
},
{
path: "/registration",
method: "POST",
method: HttpMethod.POST,
lambdaName: "registration",
},
{
path: "/users",
method: "GET",
method: HttpMethod.GET,
lambdaName: "users",
},
{
path: "/profile",
method: "GET",
method: HttpMethod.GET,
lambdaName: "profile-read",
},
{
path: "/profile",
method: "PUT",
method: HttpMethod.PUT,
lambdaName: "profile-update",
},
{
path: "/conversations/list",
method: "GET",
method: HttpMethod.GET,
lambdaName: "list-my-conversations",
},
{
path: "/conversations/create",
method: "POST",
method: HttpMethod.POST,
lambdaName: "create-personal-conversation",
},
{
path: "/conversations/delete",
method: "DELETE",
method: HttpMethod.DELETE,
lambdaName: "delete-personal-conversation",
},
{
path: "/conversations/read",
method: "GET",
method: HttpMethod.GET,
lambdaName: "conversation-read-messages",
},
{
path: "/conversations/append",
method: "POST",
method: HttpMethod.POST,
lambdaName: "conversation-add-message",
},
{
path: "/groups/list",
method: "GET",
method: HttpMethod.GET,
lambdaName: "groups-list",
},
{
path: "/groups/create",
method: "POST",
method: HttpMethod.POST,
lambdaName: "groups-create",
},
{
path: "/groups/delete",
method: "DELETE",
method: HttpMethod.DELETE,
lambdaName: "groups-delete",
},
{
path: "/groups/read",
method: "GET",
method: HttpMethod.GET,
lambdaName: "groups-read-messages",
},
{
path: "/groups/append",
method: "POST",
method: HttpMethod.POST,
lambdaName: "groups-add-message",
},
];
Expand Down Expand Up @@ -127,9 +128,9 @@ export class AngularCourseStack extends cdk.Stack {
bundling: {
externalModules: ["@aws-sdk/*"],
},
}),
})
),
routeKey: apiv2.HttpRouteKey.with("/"),
routeKey: apiv2.HttpRouteKey.with(route.path, route.method),
});
}

Expand Down Expand Up @@ -176,13 +177,13 @@ export class AngularCourseStack extends cdk.Stack {
minimumProtocolVersion: "TLSv1.2_2019",
},
},
},
}
);

// Create a DNS record. in Production it will be an apex record, otherwise we set recordName
new route53.ARecord(this, "AliasRecord", {
target: route53.RecordTarget.fromAlias(
new alias.CloudFrontTarget(distribution),
new alias.CloudFrontTarget(distribution)
),
zone: route53.HostedZone.fromLookup(this, "HostedZone", {
domainName: "rs.school",
Expand Down

0 comments on commit 4f31b57

Please sign in to comment.