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 trialSeth Missiaen
Web Development Techdegree Graduate 21,652 PointsIs express().get still required?
I've been following along with the video, but I did not receive an error when running the form with only a get
request. This is my code in app.js for the 'hello' route:
app.get('/hello', (req, res) => {
res.render('hello');
});
Andrew suggest adding app.post
with all the same information to avoid an error. Is this a difference between HTTP and HTTP2?
Thanks!
1 Answer
Seth Missiaen
Web Development Techdegree Graduate 21,652 PointsI found the reason I wasn't receiving an error. When I made my form (in the hello.pug file) I used the following code:
form(action='/hello', methods='post')
methods
should have been method
. hope this helps if someone made the same mistake I did.