Garret Harp
08/09/2021, 2:05 AMFrank
import { HttpJwtAuthorizer } from "@aws-cdk/aws-apigatewayv2-authorizers";
new Api(this, "Api", {
defaultAuthorizationType: ApiAuthorizationType.JWT,
defaultAuthorizer: new HttpJwtAuthorizer({ ... }),
routes: {
"GET /a": "src/public.main",
"GET /b": {
authorizer: new HttpJwtAuthorizer({ ... }),
function: "src/private.main",
},
},
});
Garret Harp
08/09/2021, 2:21 AM"GET /": {
handler: "src/index.handler",
authorizer: MyAuthorizer
}
Making it:
"GET /": {
function: { handler: "src/index.handler" },
authorizer: MyAuthorizer
}
Worked. Looking back at the docs now no idea how putting handler worked as I dont think that is ever shown in the docs other than under the function object.Frank
"GET /": FunctionDefinition,
or
"GET /": {
function: FunctionDefinition
authorizer: AuthorizerDefinition
}
Garret Harp
08/09/2021, 2:24 AMFrank
Frank