0

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 the html file instead of opening it in the browser.

The browser I am using is Chrome, I tried Mozilla but the result is the same.

1 Answer 1

0

You want to serve up a directory, not a specific file. So run:
http-server
or
http-server ./

Sign up to request clarification or add additional context in comments.

6 Comments

still download a file and if i try to open this file its the code html
now i discovery something strange even with my server off the link still works and download the same file
What file is it downloading?
it's a type: file and when I try to open it with visual studio or notepad it's my html code
thank you very much. I tried again today and it worked. 😎
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.