gate + 喂 (Chinese for "hello") = gatewei
An opinionated, dead-simple but powerful gateway for your microservice architecture.
npm
npm i -g gatewei
yarn
yarn global add gatewei
- 👌 Simple: Get up and running with only a few steps
- 🍃 Lightweight: Low memory footprint, no unnecessary bloat
- 📈 Scalable: Multithreaded load balancing already included
- Create a file called
config.json
or specify a path with the flag--config
- Configure to your liking using the options below
- Run
gatewei
orgatewei --config <your_config_path>
if you use a file other than the defaultconfig.json
in the current working directory.
Property | Description | Default |
---|---|---|
serverPort |
Port for gatewei to listen for incoming requests | Required to be added manually |
services |
Array of services to proxy requests for | [] |
removeRouteSlug |
Remove prefix of service (e.g /api/users will become /users ) |
true |
clusterSize |
Specify number of threads to use | Count of CPU cores |
forceShutdownOnWorkerExit |
Shut down gatewei when worker exits unexpectedly | false |
restartWorkers |
Restart worker when it exits unexpectedly | true |
enableWS |
Enable WebSocket proxying | false |
changeOrigin |
Replace Host header of proxy request with target host instead of request host | false |
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.
A service is a simple object containing the following properties
Property | Description |
---|---|
slug |
The service slug which will identify the service and be used for selecting the service to use for incoming requests |
target |
The target service URL. Can be either a simple host or even contain a path prefix |