Node.js quick file server (static files over HTTP)

前端 未结 30 2436
攒了一身酷
攒了一身酷 2020-11-22 12:30

Is there Node.js ready-to-use tool (installed with npm), that would help me expose folder content as file server over HTTP.

Example, if I have



        
30条回答
  •  面向向阳花
    2020-11-22 12:56

    You can use the NPM serve package for this, if you don't need the NodeJS stuff it is a quick and easy to use tool:

    1 - Install the package on your PC:

    npm install -g serve
    

    2 - Serve your static folder with serve :

    d:> serve d:\StaticSite
    

    It will show you which port your static folder is being served, just navigate to the host like:

    http://localhost:3000
    

提交回复
热议问题