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

前端 未结 30 2212
攒了一身酷
攒了一身酷 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:59

    Take a look on that link.

    You need only to install express module of node js.

    var express = require('express');
    var app = express();
    
    app.use('/Folder', express.static(__dirname + '/Folder'));
    

    You can access your file like http://hostname/Folder/file.zip

提交回复
热议问题