problem -> npm http-server dowloading file

I'm new to npm and I tried to start a new simple project. Initially it just had index.html with h1 Hello world. When I try to start a server using http-server ./index.html it works to some extent but when I try to open the path http://127.0.0.1:3131 it downloads a file instead of running an HTML in my browser.
The browser I am using is Chrome, I tried Mozilla but the result is the same.
Answer
You want to serve up a directory, not a specific file. So run:
http-server
or
http-server ./
Enjoyed this question?
Check out more content on our blog or follow us on social media.
Browse more questions