# HttpRouteKey

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

This class models that combination.

- Source: [`aws-apigatewayv2/lib/http/route.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-apigatewayv2/lib/http/route.ts#L81)
- Type last changed: v2.112.0 · 1 Dec 2023

## 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

- `DEFAULT`: [HttpRouteKey](/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.HttpRouteKey.html) (static) — The catch-all route of the API, i.e., when no other routes match.

- `key`: string — The key to the RouteKey as recognized by APIGateway.

- `method`: [HttpMethod](/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.HttpMethod.html) — The method of the route.

- `path`: string — The path part of this RouteKey.

  Returns `undefined` when `RouteKey.DEFAULT` is used.

## Methods

- `with(path: string, method?: HttpMethod): HttpRouteKey // chainable` (static) — Create a route key with the combination of the path and the method.

  **Parameters**

  - `method` — default is 'ANY'.
