2.0.0 • Published 2 years ago

@ii887522/reverse-proxy v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

reverse-proxy

Semantic Versioning 2.0.0 JavaScript Style Guide Linux Windows made-with-javascript made-with-typescript Npm package version Npm package daily downloads Npm package license Npm package dependents

It is a server that forwards client request to the correct web server for processing, and also forwards server response to the correct web client browser for presentation.

Table of contents

Usage

reverse-proxy <config-file-path>

config-file-path: It must exists and must not ends with either '/' or '\'.

A config file passed in must follow the format below:

{
  "keyPath": {
    "type": "string",
    "required": true,
    "format": "[^/\\]$"
  },
  "certPath": {
    "type": "string",
    "required": true,
    "format": "[^/\\]$"
  },
  "routes": {
    "type": "array",
    "required": true,
    "value": [
      {
        "hostname": {
          "type": "string",
          "required": true
        },
        "target": {
          "type": "string",
          "required": true
        }
      }
    ]
  }
}

Usage example

{
  "keyPath": "test/key.pem",
  "certPath": "test/cert.pem",
  "routes": [
    {
      "hostname": "example.dynv6.net",
      "target": "http://localhost:1024"
    },
    {
      "hostname": "www.example.dynv6.net",
      "target": "http://localhost:1024"
    },
    {
      "hostname": "abcdefg.dynv6.net",
      "target": "http://localhost:1025"
    },
    {
      "hostname": "www.abcdefg.dynv6.net",
      "target": "http://localhost:1025"
    }
  ]
}

Coding Style

This project follows Javascript Standard Style. Please familiarize yourself with the rules provided in the coding style and make sure all the proposed code changes in your commits are conforming to the style before making a merge request. You can also make use of StandardJS - Javascript Standard Style which is a Visual Studio Code plugin and npm run lint command under the Lint project section to support you.

Prerequisites

Install dependencies

npm install

Lint the project

npm run lint

Build the project

npm run build

Automatically build the project on save

npm run build:watch

Automatically restart the project on change

npm run dev <config-file-path>

Start the project

npm start <config-file-path>

Test the project with code coverage analysis

npm test

Automatically test the project with code coverage analysis on change

npm run test:watch
2.0.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago