node.jsjsonhttphttp-verbs

When use post, when use get


I have a doubt, I have an API in which I will pass a JSON to get data referring to a request.

So is it necessary to use the ResquestBody, in this case, do I use GET or POST?


Solution

  • If you want to pass a request body, you cannot use GET.

    So, use POST, PUT, or PATCH.

    Plus, GET parameters go into web server logs because they're part of URLs. So never use GET parameters for secrets. That is, always use POST for things like password updates.