https://github.com/life-is-curiosity/js-apigateway
Feature
- API Rules
Parameter checking
Support regular-expression - Distributed Load-Balancing Algorithms
Random-Weighted Average Load-balancing algorithms to route the requests to different microservice endpoints. - Asymmetric JWT Double-Lock Session
Support private api, asymmetric key lock and basic session management - Rate-Limit Components
Able to customize the rate-limit for preventing the system loading - Http API Proxy Gateway
Http API redirect to other internal service endpoints - Single Redis Instance
Session or any persistance by Redis
Environment Construction
npm install or yarn install
Configuration
{
"redis": {
"host": "localhost",
"port": 6379,
"auth": "",
"db": 0,
"max_clients": 30,
"tls": false
},
"rate_limit": {
"interval_ms": "60000",
"max_requests": "120"
},
"service_endpoints": {
"timeout": 5000,
"user": [
{
"hostname": "localhost",
"port": 3001,
"weight": 10
},
{
"hostname": "localhost",
"port": 3002,
"weight": 2
},
{
"hostname": "localhost",
"port": 3003,
"weight": 2
},
{
"hostname": "localhost",
"port": 3004,
"weight": 4
}
]
},
"session": {
"algorithm": "RS256",
"expire": 180
}
}
Execution
pm2 start pm2.json --env local > /dev/null


