@marius321967/spaserve

1.3.0 • Public • Published

Single Page App (SPA) file server based on Express.js Static middleware.

If the file is not found then requests will serve index.html with 200 status code. If user requests a special route (default: /404) then index.html will be served with a 404 status code.

Supports HTTP2 when running in HTTPS mode (using spdy).

The tool runs a single port and does not provide HTTP to HTTPS redirects. For this, find a separate tool (Docker: morbz/docker-web-redirect).

Arguments

  • --port
  • --dir the directory to serve static files from. Default: dist
  • --notfoundroute path (without leading /) which will return 404 statuses. SPAs can close & redirect to this route for a proper 404 response. Default route: 404
  • --https enables HTTPS instead of HTTP. Default: false. For self-signed certificates, see Node.JS tutorial
  • --sslkey filename of SSL private key. Default: ssl/key.pem
  • --sslcert filename of SSL certificate. Default: ssl/cert.pem
  • --sslpassphrase passphrase for SSL private key
  • --maxage seconds in Cache-Control header. Default: 600

Arguments can also be passed via uppercase environment variables.

Readme

Keywords

none

Package Sidebar

Install

npm i @marius321967/spaserve

Weekly Downloads

0

Version

1.3.0

License

ISC

Unpacked Size

4.4 kB

Total Files

3

Last publish

Collaborators

  • marius321967