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 Node.js Basics (2014) Building a Command Line Application Handling Errors in Node

Running NodeJS in the browser

I am wondering how to run NodeJS in the browser using Notepad++. I was able to do it through GItbash without any problem and got the desired result with no errors. When I tried to do run it through Notepad++, I copied and pasted "http://localhost:1337" in the browser and got the output "Hello World" when the localhost isn't having problems connecting. What do I need to do to make this work in the browswer for the work done in this video and any other future modules I create?

2 Answers

Depends on your setup.

If you put the files you are working on in the correct folder for your server (e.g. var/www/html for apache on linux), then you should just be able to use localhost to view them, assuming everything is set up ok.

How did you do it in gitbash?

I did finally get it to work. I just got the server started in Gitbash by navigating to my projects folder, which is where the file to start the server is as well as the files for this project and then copied and pasted http://localhost:1337 in the browser window when I ran it in Notepad++. I think there was a few typos I had to fix before it ran correctly in the browser, which was why the local host wasn't connecting.