1.1.5 • Published 5 years ago

gatewei v1.1.5

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

gate + 喂 (Chinese for "hello") = gatewei

Short Description

An opinionated, dead-simple but powerful gateway for your microservice architecture.

Installation

npm

npm i -g gatewei

yarn

yarn global add gatewei

Highlights

  • :ok_hand: Simple: Get up and running with only a few steps
  • :leaves: Lightweight: Low memory footprint, no unnecessary bloat
  • :chart_with_upwards_trend: Scalable: Multithreaded load balancing already included

Usage

  1. Create a file called config.json or specify a path with the flag --config
  2. Configure to your liking using the options below
  3. Run gatewei or gatewei --config <your_config_path> if you use a file other than the default config.json in the current working directory.

Options

Configuration Options

PropertyDescriptionDefault
serverPortPort for gatewei to listen for incoming requestsRequired to be added manually
servicesArray of services to proxy requests for[]
removeRouteSlugRemove prefix of service (e.g /api/users will become /users)true
clusterSizeSpecify number of threads to useCount of CPU cores
forceShutdownOnWorkerExitShut down gatewei when worker exits unexpectedlyfalse
restartWorkersRestart worker when it exits unexpectedlytrue
enableWSEnable WebSocket proxyingfalse
changeOriginReplace Host header of proxy request with target host instead of request hostfalse

When enabling WebSocket proxying, to activate the proxy, an initial request has to be sent to the target service. For more information, visit this page.

Service Configuration

A service is a simple object containing the following properties

PropertyDescription
slugThe service slug which will identify the service and be used for selecting the service to use for incoming requests
targetThe target service URL. Can be either a simple host or even contain a path prefix