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
D:\Folder\file.zip
D:\Folder\file2.html
D:\Folder\folder\file-in-folder.jpg
Then starting in D:\Folder\
node node-file-server.js
I could access file via
http://hostname/file.zip
http://hostname/file2.html
http://hostname/folder/file-in-folder.jpg
Why is my node static file server dropping requests? reference some mystical
standard node.js static file server
If there's no such tool, what framework should I use?
Related: Basic static file server in NodeJS
For people wanting a server runnable from within NodeJS script:
You can use expressjs/serve-static which replaces
connect.static
(which is no longer available as of connect 3):myapp.js:
and then from command line:
$ npm install finalhandler serve-static
$ node myapp.js
I know it's not Node, but I've used Python's SimpleHTTPServer:
It works well and comes with Python.