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

Chalkers using node to generate a dynamic site

I am confused why after the server responds to the port 3000. why it report a get method has occurred when it has not happened in the code or so it seems..

const server = http.createServer(function (request, response) { console.log("The request ", request.url, request.method); //console.log("The response", response); router.home(request,response); router.user(request, response); }).listen(3000);

console.log(Server running at http://<workspace url>/); When router.home(request, response) is called I log out to the console the request.method to see its value.

function home(request, response) { // if url === "/" && GET console.log(request.url); console.log("in home route"); if (request.url === "/") { if(request.method.toLowerCase() ==="get") { // show the search field console.log(request.method);

its shows GET but no htttp.get has been called as such.. is this implied by the / as a request for the home route. is it a get because its in the browsers address area.