Using node.js as a simple web server

后端 未结 30 2225
感情败类
感情败类 2020-11-22 02:54

I want to run a very simple HTTP server. Every GET request to example.com should get index.html served to it but as a regular HTML page (i.e., same

30条回答
  •  悲&欢浪女
    2020-11-22 03:20

    The way I do it is to first of all install node static server globally via

    npm install node-static -g
    

    then navigate to the directory that contains your html files and start the static server with static.

    Go to the browser and type localhost:8080/"yourHtmlFile".

提交回复
热议问题