Curious how others here would represent these in a REST architecture.
/users/login/ /users/logout/
These endpoints set up the session to login in the user, or clear it, respectively. My gut says POST, but I'm not in fact creating an object.
In MOST cases, forms should use the post method. In the case of logins, that would be ALWAYS use post.
The primary or most-commonly-used HTTP verbs (or methods, as they are properly called) are POST, GET, PUT, PATCH, and DELETE. These correspond to create, read, update, and delete (or CRUD) operations, respectively.
You should use POST
- using GET
for these actions can lead to issues with browser prefetching and search engine spidering. See (1, 2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With