roit-node-ms-scaffold
v0.0.1
Published
ROIT api gateway register ========================
Downloads
4
Readme
ROIT api gateway register
How to use?
Step 1: configure your routers
default:
apiGatewayHost: http://localhost:7001 # Base host of service
serviceName: service-test # Application/Module name
routers: # List routers for register
pig: # Router name
router: /api/v1/pig # Router description
envs: # List envs
dev: # Env
baseUrl: https://pig-service-dev # Base url of env
prod:
baseUrl: https://pig-service-prod
galinha:
router: /api/v1/galinha
envs:
dev:
baseUrl: https://galinha-service-dev
prod:
baseUrl: https://galinha-service-prod
bird:
router: /api/v1/bird
envs:
dev:
baseUrl: https://bird-service-dev
prod:
baseUrl: https://bird-service-prod
import { Environment, Env } from 'roit-environment';
Environment.getProperty("port") // output: 3000
// Verify env is accepted
Environment.acceptedEnv(Env.HOM) // output: false
Environment.acceptedEnv(Env.DEV) // output: true
Environment.currentEnv() // return enum Env
// Relative path example
root
-config
--dev
---foobar.json
// Param 1: subs level number (3)
// Param 2: key property
Environment.getRelativePath(3, 'credential') // output: ../../../config/dev/foobar.json