Welcome to the Treehouse Community
Looking to learn something new?
Andrew YoungCourses Plus Student 639 Points
Why use post and why not use get
Currently we use
post for vote-up and down but since you're not passing any value and html form supports get function why don't use get why use post instead?
Is it for security problems or just we usually use this method since I can copy the exact same code with same function just change the
app.get, and still working
Tom Geraghty24,162 Points
Because it's the right thing to do. We're learning, so we should probably learn the correct way to do things instead of learning ways that work but aren't technically correct.
If we comply with the spec then our apps will be better rated by Google, they won't break when the spec is changed (following SemVer), they will be predictable to others who wish to utilize/consume our API, using GET can put sensitive information in the URL header which is more exposed to snoops, etc etc etc.
A couple good resources for more info: https://medium.com/@suhas_chatekar/why-you-should-use-the-recommended-http-methods-in-your-rest-apis-981359828bf7 https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html