File Server
Overview
The file server is a script that complies with the davinci specification for a file server over HTTP, that is, it allows
you to make files on you local hard drive available to the browser. Of course, this comes with a set of security risks
and should be done with care.
The file server will run from within a folder on your hardrive, and will serve file from a folder named
"root" within that folder.
Running the Server
To run the server, enter the following command within the file server directory.
node file-server.js
This should start the server on your local machine. It will be running on port 2800. (You can change the port that the server
runs on by editing the script.)
Recursing the Folder Structure
let ut = await import('/lib/file-server/v1.0.0/util.mjs');
let urls2 = await ut.recurse("http://localhost:2800/folder1/", $url);
Extending the Server
The file server provided here contains the basic functionality to comply with the davinci file server specification.
The script can be extended to provide additional functionality, as listed below.
- Authentication: lets you authenticate the user from the http headers in the http request.
If not authenticated, no data is returned.