Skip to content

Feature request: Support for a catch all route in Event Handler REST API #4579

@sdangol

Description

@sdangol

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

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 Utilityfeature-requestThis item refers to a feature request for an existing or new utilitypending-releaseThis item has been merged and will be released soon

Type

No type

Projects

Status

Coming soon

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions