I wanna make a server-side database query based on the following data from the client:
const passengers = {
adults: 5,
teens: 1,
kids: 2,
babies: 3,
pets: 0
};
What I know
I'm aware that I can send all the properties as individual query parameters, but I'm going to be sending some other ones and I'm interested in:
- Grouping some of the data I send.
- The capability of sending more complex objects with nested properties.
I'm also aware that I can switch to a POST request that accepts a JSON body, but I was willing to stick with GET since the response is a list of the queried entity and I think that GET suits better that concept as POST is rather meant for creating elements.
Is using POST the only option or can I solve this with a GET request?