nginx-unit-client

0.0.1 • Public • Published

Nginx Unit Client

Usage

Create and config

const createClient = require('nginx-unit-client');

const client = createClient({
  unixPath: '/var/run/control.unit.sock' // default: /var/run/control.unit.sock
});

;(async () => {
  await client.delete(); // reset configs

  await client.put('/config/routes', [
    {
      "match": { "host": "example.com" },
      "action": { "proxy": "http://127.0.0.1:8080" }
    }
  ]); // create routes
})();

Support methods

  • client.get(path)
  • client.put(path, payload)
  • client.delete(path)

References

You can read more about the Nginx Unit at: https://unit.nginx.org/

License

MIT

Package Sidebar

Install

npm i nginx-unit-client

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

4.86 kB

Total Files

6

Last publish

Collaborators

  • anhhao.me
  • haova