komg

2.1.8 • Public • Published

komg

NPM Version Node Version

A mini kong, lightweight microservices manager.

Admin UI

admin

Installation

Firstly, Node.js and Redis are required.

npm i -g komg

Run

komg
 
or
 
komg --port=2350 --db=./db.json --env=prod --redis=redis://127.0.0.1:6379/0 --basic-auth=name1=pass1

then open http://localhost:2350/admin with your browser.

Argv

  • -p/--port, set port for http server, default 2350
  • --db, set db path, default $komg/lib/db_test.json
  • --env, dev/prod, default dev(allow all requests without apikey)
  • --redis, redis url
  • --basic-auth, add a basic authorization for admin

Usage

  • 1.If you add a api like this
{
  "name": "test",
  "path": "/test",
  "targets": [
    {
      "url": "http://localhost:3001",
      "weight": 1,
      "status": 1
    }
  ],
  "consumers": [
    {
      "apikey": "All",
      "status": 1
    }
  ],
  "order": 1
}

your requests to http://localhost:2350/test will be proxied to http://localhost:3001

  • 2.If you add a api like this
{
  "name": "test2",
  "path": "/test2",
  "targets": [
    {
      "url": "http://localhost:3002",
      "weight": 1,
      "status": 1
    }
  ],
  "consumers": [
    {
      "apikey": "adsf1324asdfg",
      "status": 1
    }
  ],
  "order": 1
}

your requests to http://localhost:2350/test2 will be asked an apikey in the headers, like this headers:{Content-Type:'application/json',apikey:'adsf1324asdfg'}

Scalable

If you install komg on server A,server B, your changes on A will be synchronized to B since a subscriber running on each komg, and you just need to press the refresh button to update upstream configs in the memory.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i komg

Weekly Downloads

8

Version

2.1.8

License

MIT

Unpacked Size

1.93 MB

Total Files

37

Last publish

Collaborators

  • cooperhsiung