generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 175
Closed
Labels
event-handlerThis item relates to the Event Handler UtilityThis item relates to the Event Handler Utilityfeature-requestThis item refers to a feature request for an existing or new utilityThis item refers to a feature request for an existing or new utilitypending-releaseThis item has been merged and will be released soonThis item has been merged and will be released soon
Description
Use case
Currently, the Event Handler supports specific route patterns, but there's no built-in support for catch-all routes that can handle arbitrary paths. This is useful for:
- Creating fallback handlers for unmatched routes
- Building proxy-like functionality where you want to capture all requests under a certain path
- Implementing wildcard routing patterns
Solution/User Experience
Add support for catch-all routes using regex patterns like .+
that can match any path. This would allow developers to create flexible routing patterns that can handle multiple path segments.
import { APIGatewayResolver } from '@aws-lambda-powertools/event-handler/resolvers';
const app = new APIGatewayResolver();
app.get('.+', () => {
return {
message: 'Hello, World!'
};
});
export const handler = async (event, context) =>
app.resolve(event, context);
Alternative solutions
Acknowledgment
- This feature request meets Powertools for AWS Lambda (TypeScript) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
Metadata
Metadata
Assignees
Labels
event-handlerThis item relates to the Event Handler UtilityThis item relates to the Event Handler Utilityfeature-requestThis item refers to a feature request for an existing or new utilityThis item refers to a feature request for an existing or new utilitypending-releaseThis item has been merged and will be released soonThis item has been merged and will be released soon
Type
Projects
Status
Coming soon