Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Build a Simple Dynamic Site with Node.js Handling Routes in Node.js User Route

Gianni Zamora
Gianni Zamora
9,547 Points

http://localhost:8080/ the webpage is not available

var http = require('http');
http.createServer(function (request, response) {
  router.home(request,response);
  router.user(request,response);
 }).listen(8080, '127.0.0.1');
console.log('Server running at http://127.0.0.1:8080/');

I have the same exact code from the videos but my local webpage wont load. I looked at stackoverflow and they said this: http://stackoverflow.com/questions/19608330/http-localhost8080-is-not-working

I'm new to node so i dont know how to implement the recommendations listed in the SO forum.

2 Answers

Can you include the code from your router.js file?

We're essentially sending the response straight away (or after the entire request is received), we're not responding as the request is 'streaming in'.

Andrew Smith
Andrew Smith
14,330 Points

Sorry, but I haven't ever used Node.js.