Svr: Simple HTTP(S) Server
This package provides a simple HTTP(S) server to deliver HTML, TypeScript, and other files to web browsers.
Examples
-
Start a HTTPS server with
htmlfolder as the website’s root:npx svr --https --root html -
Start a HTTP server with log files:
npx svr 1>> svr.log 2>> svr-error.log
Options
All options are optional.
-
--cgi [path]: Activates CGI path for web browsers. -
--http [port]: Activates HTTP port. Port number is optional. -
--https [port]: Activates HTTPS port. Port number is optional. Without httpsCert and httpsKey a sels-signed certificate will be created instead (requires OpenSSL). -
--httpsCert [file]: File path to the HTTPS certificate. -
--httpsKey [file]: File path to the HTTPS key. -
--root [folder]: Root folder with files for web browsers. -
--stop [seconds]: Stops the server after the given amount of seconds.
Redirect Output
The following patterns follow last.
-
1> [file]: Redirect request log to a file. Replaces an existing file. -
1>> [file]: Redirect request log to a file. Append to existing file. -
2> [file]: Redirect error log to a file. Replaces an existing file. -
2>> [file]: Redirect error log to a file. Append to existing file.