https://github.com/typescriptlibs/svr
Simple HTTP(S) Server
https://github.com/typescriptlibs/svr
Last synced: about 1 year ago
JSON representation
Simple HTTP(S) Server
- Host: GitHub
- URL: https://github.com/typescriptlibs/svr
- Owner: typescriptlibs
- License: mit
- Created: 2023-05-27T08:19:58.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-26T22:15:43.000Z (almost 3 years ago)
- Last Synced: 2025-03-09T23:16:13.515Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://typescriptlibs.org/svr/
- Size: 106 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Security: SECURITY.md
- Authors: AUTHORS.md
Awesome Lists containing this project
README
Svr: Simple HTTP(S) Server
==========================
This package provides a simple HTTP(S) server to deliver HTML, TypeScript, and
other files to web browsers.
[](https://github.com/typescriptlibs/svr/actions/workflows/codeql.yml)
[](https://github.com/typescriptlibs/svr/actions/workflows/node.js.yml)
[](https://www.npmjs.com/package/@typescriptlibs/svr)
[](https://github.com/typescriptlibs/svr/blob/main/LICENSE.md)
Examples
--------
- Start a HTTPS server with `html` folder as the website's root:
``` Shell
npx svr --https --root html
```
- Start a HTTP server with log files:
``` Shell
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.