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 trialOllie Khakwani
1,975 PointsWhy do you check if the request method is "GET" in the 'home' route?
I've been building an alternative version where a user enters a zipcode into a form and it'll retrieve the weather forecast. I'm confused about why in the home route you'd check if the request method is 'GET' to show the initial search page – it loads fine when I just have if(request.url === "/") {...}, but the request doesn't load anything if I add an if(request.method.toLowerCase === 'get'){...} inside that 'if' clause.
Leon Segal
14,754 PointsLeon Segal
14,754 PointsDid you try:
if (request.method.toLowerCase() === 'get'){...}
with parentheses?