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

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