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 Redirection Headers in Node.js

Redirect not working

When I click on search for chalkers the page goes to a blank gray screen. Here is the code for that section.

else {
      //if url == "/" && POST

      //get the post data from body
      request.on('data', function(postBody){
        //extract the username  
        var query = querystring.parse(postBody.toString());
        //redirect to /:username
        response.writeHead(303, {'Location': '/' + query.username });
        response.end();
      });
    }

here is a snapshot of my workspace.

https://w.trhou.se/z0dm27fnzl

1 Answer

Thanks Andrew Chalkley! When you have the opportunity can you explain why it worked when I would manually type the username at the end of the url and why it wouldn't work if i entered it into the search field. Just trying to understand how that extra dot messed up the search and not the manual entry. Thanks again!