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 Build a Simple Dynamic Site with Node.js HTTP Methods and Headers HTTP Methods and Headers Review

Finish the following code. How do you find out the HTTP method of a request?

well I tried response and get its a nogo so far.

3 Answers

The property should be method

Some links from the docs:

http.IncomingMessage

and in particular, message.method

Andrew Bush
Andrew Bush
10,953 Points

The answer is in router.js around line 10. This is where the request url is evaluated with a conditional if to see whether it is a "get" or POST.

request.method

It is "request.method"