是否有 Node.js 即用型工具(与 npm
一起安装),这将帮助我通过 HTTP 将文件夹内容公开为文件服务器。
例如,如果我有
D:\Folder\file.zip
D:\Folder\file2.html
D:\Folder\folder\file-in-folder.jpg
然后从 D:\Folder\
node node-file-server.js
开始,我可以通过
http://hostname/file.zip
http://hostname/file2.html
http://hostname/folder/file-in-folder.jpg
为什么我的节点静态文件服务器丢弃请求? 参考一些神秘的
标准 node.js 静态文件服务器
如果没有这样的工具,我应该使用什么框架?
原文由 Paul Verest 发布,翻译遵循 CC BY-SA 4.0 许可协议
一个好的“即用型工具”选项可能是 http-server:
要使用它:
或者,像这样:
看看: https ://github.com/nodeapps/http-server