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 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.