@typescriptlibs/svr
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Svr: Simple HTTP(S) Server

This package provides a simple HTTP(S) server to deliver HTML, TypeScript, and other files to web browsers.

CodeQL Node.js NPM License

Examples

  • Start a HTTPS server with html folder 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.

Package Sidebar

Install

npm i @typescriptlibs/svr

Weekly Downloads

5

Version

0.2.0

License

MIT

Unpacked Size

58.5 kB

Total Files

31

Last publish

Collaborators

  • typescriptlibs