# gatewei

> Scalable gateway microservice for microservices

Latest version **1.1.5** (published 2019-02-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install gatewei
pnpm add gatewei
yarn add gatewei
bun add gatewei
```

Provides the command `gatewei`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2019-02-08 |
| First published | 2018-05-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 89.4 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Maintainers | brunoscheufler |
| Keywords | gateway, microservice, proxy |

## Links

- npm: https://www.npmjs.com/package/gatewei
- Repository: https://github.com/ikkakujuu/wei
- Homepage: https://github.com/ikkakujuu/wei#readme
- Issues: https://github.com/ikkakujuu/wei/issues
- npm.io page: https://npm.io/package/gatewei

## Dependencies (8)

- [pino](https://npm.io/package/pino.md) ^4.16.1
- [helmet](https://npm.io/package/helmet.md) ^3.12.0
- [rimraf](https://npm.io/package/rimraf.md) ^2.6.2
- [express](https://npm.io/package/express.md) ^4.16.3
- [fs-extra](https://npm.io/package/fs-extra.md) ^6.0.1
- [commander](https://npm.io/package/commander.md) ^2.15.1
- [http-status](https://npm.io/package/http-status.md) ^1.1.0
- [http-proxy-middleware](https://npm.io/package/http-proxy-middleware.md) ^0.18.0

## Recent versions

- 1.1.5 (latest) — 2019-02-08
- 1.1.4 — 2018-05-20
- 1.1.3 — 2018-05-19
- 1.1.2 — 2018-05-18
- 1.1.1 — 2018-05-17
- 1.1.0 — 2018-05-17
- 1.0.0 — 2018-05-16

## README

<div align="center">
	<br>
	<img width="200" src="media/logo.svg" alt="gatewei">
	<br>
</div>
<h1 align="center">gatewei</h1>

> 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

| 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](https://github.com/chimurai/http-proxy-middleware#external-websocket-upgrade).

### Service Configuration

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

---
_Source: https://npm.io/package/gatewei · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
