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

Trouble viewing the page

Hello!

I have an issue running app.js in node - the browser looks up 127.0.0.1 in Yahoo instead of showing the html. My code is here:

https://github.com/ksenia0822/Node.js_SimpleDynamicSite_TreeHouse

Many thanks in advance!

2 Answers

Hi Ksenia-

I was able to get a server started by just listing the port. See here:

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

Are you using Node on Workspaces or your local computer? If you are using on Workspaces, 127.0.0.1 won't work as that is a default local address for a local server.

Greg

Hi Greg! I am using console, not the workspace and unfortunately it still doesn't work.

how do we get it on the web page?