user1869935 user1869935 - 1 year ago 121
HTTP Question

Why is this http-server doing this?

I'm new to Node and I'm trying to run a local server.

I followed this simple steps: Setup a simple Node server.

I move to the folder I have the index.html file:

enter image description here

I run http-server then I browse to http://localhost:8080/ and this is what I get:

enter image description here

I have no idea what I am doing wrong.

Answer Source

This one has caught me out a couple of times too - if you have a ./public folder, the http-server library defaults to serving that rather than ./. Kind of a silly default, in my opinion, but oh well!

You can get around this by explicitly stating the path when you start the server:

http-server ./
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download