Simple HTTP and HTTPS webserver to host static files
How to use this:
- Clone ro download this repository
- Install the dependencies
$ npm install
- Run the software
$ node main.js
If basicAuth is enabled, the usual basic authentication prompt will be shown asking for password. The default password is set in main.js function basicAuth(req, res, next)
const auth = { login: 'admin', password: 'P@ssw0rd' } // change this
This line shows that basicAuth is inserted at the beginning of ExpressJS middleware:
// with basic authentication
obj.app.use(basicAuth, obj.express.static(__dirname+'/public'), obj.serveindex(__dirname+'/public', {'icons': true}));
// without basic authentication
//obj.app.use(obj.express.static(__dirname+'/public'), obj.serveindex(__dirname+'/public', {'icons': true}));
To disable basicAuth,
// with basic authentication
//obj.app.use(basicAuth, obj.express.static(__dirname+'/public'), obj.serveindex(__dirname+'/public', {'icons': true}));
// without basic authentication
obj.app.use(obj.express.static(__dirname+'/public'), obj.serveindex(__dirname+'/public', {'icons': true}));
Have fun.
Oh btw, the root certificate of the issuer is downloadable (root.cer) for your convenience to load this into your trusted certificate storage.