koa-c3po
v0.0.20
Published
A Boilerplate application for building REST APIs. This is not stable. If you are not me there is no reason to use at this point.
Downloads
27
Maintainers
Readme
Summary
This is a simple framework based on koa that incorporates logging, instrumentation, and tracing by default.
Configuration
Configuration is done by default in yaml files. In the working directory the application will use config.yaml
as the default profile and config-{profile}.yaml
for other profiles. In addition the default config may also contain profile yaml segments as a multi-document yaml. If this is done all segments other than the default should contain a profile key to signify what profile it represents.
Values are retrieved in the following order, from lowest precedence to highest:
- default values in app
- values from the default config
- values from a profile specific config (in order of precedence)
- environment variables
For profiles they are listed in increasing order of precedence. As an example if profiles are "default,a,b" values in b will override values in a or default. If default is not listed it is added as the first element in the profile list.
Logging
Jaeger
Jaeger config is as follows:
jaeger:
enabled: true
config:
serviceName: 'my-awesome-service'
reporter:
logSpans: true
agentHost: 'localhost'
agentPort: 6832
sampler:
type: 'probabilistic'
param: 1.0
TODO: add option
section once implemented
For values see: https://github.com/jaegertracing/jaeger-client-node/blob/master/src/configuration.js#L37
Prometheus
TODO: Not much in the way of configuration but document once I surface
Running
PROFILES={comma separated profiles} A2R={example to run} node index.js
to run application 1:
PROFILES=logging,jaeger A2R="./example01/" ./build/nodejs/node-v8.10.0-linux-x64/bin/node index.js
to run application 2:
PROFILES=app2,logging,jaeger2 A2R="./example02/" ./build/nodejs/node-v8.10.0-linux-x64/bin/node index.js