Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

node.js, npm - http-server


Ninjadoodle
 Share

Recommended Posts

Hi guys

 

So, I've finally got the Panda installation running with npm and http-server

 

I know that I can use ...

 

http-server -o

 

... to open a browser window with the web server running, but I can't figure out how to run a specific html file, as the server defaults to running index.html by default.

 

I understand that I can add ...

 

http://0.0.0.0:8080/dev.html

 

... on the end of the address in order to run another file, but I'm wondering whether there is a way to run dev.html from the command line, when starting the server?

 

Thank you in advance!

Link to comment
Share on other sites

Evading the explanation how web servers work. There are two things you could do. Since you are already using nodejs use it to point default endpoint to dev file instead index. If you don't know how to do it. Then maybe the best option would be just to rename dev file to index.html that way you will always run it by default. And you use predefined index file on your deploy system. Let me know if that helped. 

Link to comment
Share on other sites

Hi @Neso

 

Yeah web servers are definitely not my strong point :(

 

I try to focus on game making and usually avoid the technical web stuff like the plague. Lately tho, I have been trying to understand it all and have been reading various tutorials.

 

I thought there might be an easy flag or command I could add after running 'http-server' in Terminal, but it looks like it's more complex than that. I think the renaming suggestion is the the most straight forward,without having to dig too much deeper.

 

Thank you for your help!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...