The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

markrbower (13) [Avatar] Offline
Have been running the examples as I go and am enjoying the book. The explanations have been thorough, until I ran into listing 6.15, which had a cryptic note "Executing this example ... requires running a server." The linked website helped me get a http-server running on my machine, but I still can't get the example to run. I've started the http-server and can access it from a browser, but then how do I point my JavaScript code at the server? What would be helpful would be a step-by-step guide, much like what is done for each example in the book: "1. start the http-server, 2. ..."

Josip Maras (30) [Avatar] Offline

You can, for example install: (and to run npm, you need to install node:

Once you've done that, through your console, navigate to the book's source code folder (the one with folders chapter-01, chapter-02, etc.), and run: http-server.

This will start a local server at: localhost:8081. You can open that location using your browser, and through it navigate to http://localhost:8081/chapter-06/listing-6.15.html.

markrbower (13) [Avatar] Offline
Perfect! It took a bit of twiddling with the address, but it makes sense once you realize that the http-server considers the directory in which it starts to be the "root" or "home" directory. While easy to install, the http-server website is quite limited in regards to "help" or tutorials.

For my case, http-server gave the following notice:
$ http-server
Starting up http-server, serving ./
Available on:
Hit CTRL-C to stop the server

In my browser (Safari), I had to type

where I had to make sure that the URL address ( in the address I gave the browser. I point this out for others who are as familiar with running servers as I am (which is "not").

I'm sure this is trivial to those who already know, but such info is sometimes the hardest to find when you don't know.

Thank you!