2.2.2 • Published 1 year ago

koapache v2.2.2

Weekly downloads
4
License
LGPL-3.0
Repository
github
Last release
1 year ago

KoApache

A Web server which is easy to use in Command-line or as a forked Child process based on Koa.

NPM Dependency CI & CD

NPM

Feature

  1. index.html omissible in URL

  2. Log HTTP request & response in Command-line output

  3. Listening port supports Random, Number or Environment variable name

  4. Support CORS headers

  5. Reverse proxy can be configurated in package.json

  6. Support to open http://your_LAN_IP:port/ in your default browser on Command-line mode

Usage

Command-line

web-server ./path/of/public/folder/

Help information output from web-server -h:

web-server [dir] [options]

A Web server which is easy to use in Command-line or as a forked Child process based on Koa

Options:
  --CORS                  Enable CORS middleware
  -h, --help              show Help information
  -o, --open     [path]   Open the Index or specific page in default browser
  -p, --port     <value>  Listening port number (support Environment variable name)
  -v, --version           show Version number

Module

import WebServer from 'koapache';

const server = new WebServer({
    staticPath: './path/of/public/folder/',
    netPort: 'DOCKER_INTERNAL_PORT',         //  Get listening port from Shell environment
    XDomain: true,                           //  enable CORS
    proxyMap: {                              //  Reverse proxy map based on String#replace()
      "^/github/(.+)":  "https://api.github.com/$1"
    }
});

server.workerHost().then(address  =>  console.dir( address ));

API document is accessed through npm start (offline), npm docs (online) or Official Website.

Typical case

https://www.npmjs.com/package/koapache?activeTab=dependencies

2.2.2

1 year ago

2.2.1

2 years ago

2.2.0

2 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago