Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Express Basics Deeper into Routing with Express Solution: Clearing Cookies and Redirecting

Phillip Belleau
Phillip Belleau
683 Points

App.post vs App.get

Can someone explain the difference between these to me? There isn't a lot online as far as comparing the two. If you have examples along with the explanation I will love you.

I defaulted to creating app.get for goodbye route here, not the app.post - so I'm clearly missing something here.

1 Answer

Travis Alstrand
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Travis Alstrand
Treehouse Teacher

Putting it in the simplest way possible, a GET request is used to fetch data and bring it back and a POST request is used to submit / store data.

So when a user wants to see a certain webpage, they're sending a GET request for that data.

And if a user wants to store something, like data from a form for example, they would use a POST request.