In this video, we are going to start developing our lambda function code according to HTTP, get incoming
events from the Amazon API gateway.
So let's open the Visual Studio code and let's focus on the get and get buy ID request, which comes
from the API gateway in the gate request.
We have a resource path and a HTTP method.
These are the important attributes and get by ID.
Jason Pyle.
Again, the important attributes are resource, pet and method.
But this time if there is a pet parameters, if you scroll down, we can see additional attributes,
which is the pet parameters and giving the ID and volume information.
So we should check the pet parameters for the get by ID event and otherwise we should only check for
the estimated get for the gate JSON object.
So according to this assumption, let's develop our actual lambda function, go to index and we will
implement these to this statement.
So according to incoming event, we basically check the event estimated for that purpose, we will write
a switch statement.
Let me write first and explain after that.
Let me start with the switch statement.
If you look at the switch statement, it is the condition is the event that HDV method.
So that means every incoming event starting with the active method.
So that's why we can check the HTTP method of the incoming event json object.
This will be the get post put on the IT operation.
And after that we will check that if there is a get request, we have one if condition which is looking
to patch parameters.
If there is a pet parameters, that means it comes from the get by ID request.
And after that we will check the pet parameters and get the ID information.
If you look at the indexes, we basically get the ID value in here and passing these value to the get
product method that we will be develop implement this method in the upcoming videos.
But after the if statement, there is a s block which is basically get all products because if there
is there is no any pet parameters, that means get all product requests coming from the Amazon API gateway.
And so that's why we will design our switch statement to get all products.
As you can see that there is a two method that we didn't implement yet.
We will implement these methods in the upcoming videos, but before that we should design our switch
statement and understand and accommodate incoming event JSON object.
So if you go to the API gateway console, you can also see that in here, we basically accommodate this
get request and also this get by idea request.
Okay, now it is time to implement our get and get by ideologic into our index case file.
So in the next video we will start with the get product method.