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 React Components Build Modular Interfaces With Components React Update

Austin Miller
Austin Miller
1,047 Points

How do you create a local server?

The video says to download the files and then create a local server. It says that one way to do that is to use a plugin in Visual Studio. I don't use Visual Studio, and the video doesn't mention any other ways to set up a local server. How do I do that?

This should really be part of the video, or at least mentioned in the teacher's notes.

2 Answers

Laura Coronel
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Laura Coronel
Treehouse Teacher

Hey Austin Miller You are totally right! I just added a teacher's note on another way of launching a local server but I'll also type it up here.

If you don't use Visual Studio Code, one way of launching a local server is by using the http-server package. To use it first open your terminal and navigate to the scoreboard project files. Run npx http-server . -o -c-1 The -o should automatically launch your project in the browser. If not the terminal will tell you the url to navigate to in your browser to see the project. Might look something like this:

laura scoreboard %npx http-server . -o -c-1
Starting up http-server, serving .

http-server version: 14.1.1

http-server settings: 
CORS: disabled
Cache: -1 seconds
Connection Timeout: 120 seconds
Directory Listings: visible
AutoIndex: visible
Serve GZIP Files: false
Serve Brotli Files: false
Default File Extension: none

Available on:
  http://127.0.0.1:8080
Hit CTRL-C to stop the server
Open: http://127.0.0.1:8080

Let me know if this works or if you're having any issues with it!

Laura Coronel
seal-mask
.a{fill-rule:evenodd;}techdegree
Laura Coronel
Treehouse Teacher

Ohh and to see any changes you made to the code in the browser. Be sure to save the file and reload the browser.

Austin Miller
Austin Miller
1,047 Points

Thanks so much Laura Coronel! That worked great. Cheers