I have just started with AWS Serverless and I am having some doubts. Here is my use case and what I have tried and done so far:
Use Case:
Make multiple GET and POST requests to an API using HTTP API(not REST API) in AWS using lambda function.
What I have done:
Created an HTTP API. Using $default stage currently. Created a POST route. Created a function(in python) with POST request. Attached the function integration with my POST route. I am successfully able to call this route using my frontend code(written in vanilla js). Using the data that I receive from frontend, I call an external API using it's URL in my python lambda function.
Problem:
I want to make a GET request to another API using it's URL. Will I have to make another lambda function to do so?
Any help will be great. Pardon me if I have asked a silly question. It's just that I am new to AWS and HTTP API. Thank You for your time!
Based on the comments.
A single lambda function can be used for both POST and GET requests. For this, you can have either two routes, one for POST and one for GET. Both can be integrated with the same function.
Alternatively, you can have one ANY route to route everything into a single function.
The function can have same file and same handler. However, its logic must be probably modified to handle POST and GET events differently, depending on your use-case.