How to run html file on localhost?

后端 未结 8 676
再見小時候
再見小時候 2020-12-04 08:41

I have a html file and i run it on localhost. But, this file includes mirror using webcam. Example, how can i run this html file on localhost? Webcam starting on this exampl

8条回答
  •  無奈伤痛
    2020-12-04 09:29

    • Install Node js - https://nodejs.org/en/

    • go to folder where you have html file:

      • In CMD, run the command to install http server- npm install http-server -g
      • To load file in the browser run - http-server
    • If you have specific html file. Run following command in CMD.- http-server fileName

    • by default port is 8080

    • Go to your browser and type localhost:8080. Your Application should run there.

    • If you want to run on different port: http-server fileName -p 9000

    Note : To run your .js file run: node fileName.js

提交回复
热议问题