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

How to do all this on a local machine?

Actually, I have everything installed.

  1. Node.js is installed
  2. The Project files downloaded.

And I'm running a Windows Machine.
Using the Powershell as the command line for Node.js

So I was wondering, how can I open files in the browser as done in the video through workspaces?What if I want to do it locally. With all the local tools. Without Workspaces. How would I do that? thank you for your time.
:confused:

4 Answers

Duy Khanh
PLUS
Duy Khanh
Courses Plus Student 4,911 Points

run in local its really easy . but i recommend reading the nodejs basic in w3school , it's really easy to know how its working . Belive me , it the second time i replay video again and match what teacher doing in w3school and note it to my file and now i really remmember and know what i learned . ;) Have fun :D

Zack Lee
PLUS
Zack Lee
Courses Plus Student 17,650 Points

You need to run a local server from the project directory...not sure how to do it on windows. But you could use an npm module like httpServer, or use a dev tool like gulp or webpack to run a server.

Oh, thank you for your time, Zack Lee. Actually, I'm looking forward to getting a more detailed solution, any resource for that? tnx.

Zack Lee
Zack Lee
Courses Plus Student 17,650 Points

Nafis Fuad there is a course on gulp in one of the javascript tracks. its a great dev tool and is really powerful, but requires a lot of setup.

http-server docs can be found here: https://www.npmjs.com/package/http-server install globally this is a much simpler solution. you can run the command: http-server [path] where path is a path to the directory you wish to pull from.

Oh, thank you, Duy Khanh. I'm gonna try it right away. :smile: