Skip to content
v2.274.0

HttpRouteKey Class ​

HTTP route in APIGateway is a combination of the HTTP method and the path component.

This class models that combination.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apigatewayv2 as apigatewayv2 } from 'aws-cdk-lib';
const httpRouteKey = apigatewayv2.HttpRouteKey.with('path', /* all optional props */ apigatewayv2.HttpMethod.ANY);

Properties ​

DEFAULTHttpRouteKeydefaultHttpRouteKeyDEFAULTHttpRouteKeyDEFAULTHttpRouteKeyDEFAULTHttpRouteKeyrequiredstatic#
The catch-all route of the API, i.e., when no other routes match.
keystringkeystrkeyStringKeystringKey*stringrequired#
The key to the RouteKey as recognized by APIGateway.
methodHttpMethodmethodHttpMethodmethodHttpMethodMethodHttpMethodMethodHttpMethodrequired#
The method of the route.
pathmay be undefinedstringpathmay be undefinedstrpathmay be undefinedStringPathmay be undefinedstringPathmay be undefined*string#
The path part of this RouteKey.

Returns undefined when RouteKey.DEFAULT is used.

Methods ​

with(path: string, method?: HttpMethod): HttpRouteKey // chainable@staticmethod def with(path: str, method: typing.Optional[HttpMethod] = None) -> HttpRouteKeypublic static HttpRouteKey with(String path, HttpMethod method)public static HttpRouteKey With(string path, HttpMethod? method = null)func With(Path *string, Method HttpMethod) HttpRouteKeystatic#
Create a route key with the combination of the path and the method.
1 parameter

Parameters

  • methodmethodmethodmethodMethod — default is 'ANY'.