react-lambda-example
react-lambda-example copied to clipboard
Aws Api gateway route
Hi,
I would assume you expose lambda function via AWS API Gateway. May I know how many endpoint path you define in API gateway to route different static page like home, about and etc.
It can be just a single API Gateway endpoint, as all the request details are passed to the Lambda, so from there you are able to perform routing based on the path that was entered in the URL. And API Gateway can be configured to always pass all routes to the same Lambda function.
Let's say I have route below /Home /Room/(id)
So I would need to define api gateway path:
- /home
- /Room/(path variable for id)
What if I add context route path: /Base/home /Base/room/(Id)
Can I just configure a single API gateway path which is /base to accept both route? I trying to avoid have to configure multiple API gateway path whenever I introduce new route.
As far as I remember you can configure such paths in APIG:
/{variable1}/{variable1}/{variable2}/{variable1}/{variable2}/{variable3}
And point all of them to your Lambda. Next use variable1/2/3 to return a specific HTML for your path.