2

I've just installed http-server via:

npm install --global http-server

I want to set up a server that will show me my directory listing for testing and learning purposes. I've already experimented with:

-d Show directory listings (defaults to true)

-i Display autoIndex (defaults to true)

But all the time after creating a server it opens index.html instead of directory listing.

This is more or less what I'd like to get instead of opening index.html:

directory listing

What I would like to achieve:

screenshot

Community
  • 1
  • 1
sitek94
  • 80
  • 1
  • 6

2 Answers2

1

-i Display autoIndex (defaults to true)

This is what makes http-server display the index (enabled by default), you can turn this off like that:

http-server -i false
Mickael B.
  • 4,755
  • 4
  • 24
  • 48
  • I could swear that I tried this yesterday but only today when I read your comment it works for me, thank you so much! – sitek94 May 10 '20 at 12:06
0

This should work fine

npm install http-server -g
cd Directory/
http-server

If you don't want to use Http-server follow on this answer

  • Thanks! It's almost what I'm trying to achieve. Now when I run `http-server` I can see my directory folder but when I click on it, it automatically runs `index.html` even though there are some other files as well. – sitek94 May 09 '20 at 09:38