masx200 / serve-cli

A simple zero-configuration command-line static file server based on koa2.

Repository from Github https://github.commasx200/serve-cliRepository from Github https://github.commasx200/serve-cli

serve-cli

Description

A simple zero-configuration command-line static file server based on koa2.

支持范围请求,条件请求,内容压缩,跨域访问,添加 etag 头部

Installation

Globally via yarn

yarn global add @masx200/serve-cli

Running on-demand:

npx @masx200/serve-cli [options]

Examples

npx @masx200/serve-cli --help
serve-cli
usage: serve-cli [options]

options:
  --path,-pa       Path to folder [process.cwd()]
  --host,-h       Host to use [0.0.0.0]
  --port,-po       Port to use [4000]
  --ssl,-s        Enable https [false]
  --sslKey     Path to ssl key file [self-signed]
  --sslCert    Path to ssl cert file [self-signed]
  --help,-h       Print this list and exit

TLS/SSL

First, you need to make sure that openssl is installed correctly, and you have key.pem and cert.pem files.

Then you need to run the server with --ssl for enabling SSL and --sslKey=key.pem --sslCert=cert.pem for your certificate files.

About

A simple zero-configuration command-line static file server based on koa2.

License:Other


Languages

Language:TypeScript 98.5%Language:JavaScript 1.3%Language:HTML 0.1%