TOC:
- NodeJS v7.6.0+
Create a new app and add the following to package.json:
"dependencies": {
"quadro": ""
}In app.js add:
const Quadro = require('quadro')
Quadro()You're done! Run with:
node app.js [--watch]Local configuration: You can maintain your local-machine specific configuration config/local. For git to ignore those changes use:
git update-index --skip-worktree **/config/local/*Test with:
node app.js test [--watch]Config files should be placed in ROOT/config/ dir.
To get value of key.nestedKey in configuration file named config/someConfig.yml:
app.config.someConfig.key.nestedKeyFor safe configuration fetch, use config.get:
app.config.get('someConfig.key.nestedKey')To get value of key.nestedKey in config/someConfig.yml|yaml|js|json and
defaults to 3000 if such key doesn't exist
app.config.get('someConfig.key.nestedKey', 3000)Quadro will load configuration from these paths (in the following order):
- config/
- config/$NODE_ENV
- config/local
Note: $NODE_ENV - is the NODE_ENV environment variable value
Configurations are merged while loading. In the following example:
|-- config/quadro.yml
|- dev/quadro.yml
|- local/quadro.yml
Configuration keys from local/quadro.yml will override keys from dev/quadro.yml
which in turn will override keys from config/quadro.yml.
It is highly recommended that any config values that are tweaked during debugging/development
will be added to local/ configs. This way you can add **/config/local/ to .gitignore
and be able to keep your dev environment clean during commits/pushes.
To run tests use:
node app.js testTo make tests re-run on file changes use:
node app.js test --watchUse config value: quadro.http.port
Default: 3000
Use app.log.trace|debug|info|warn|error
Set logging level through config quadro.logger.level. Default is info.
.log- Logger.env- Runtime environment (dev|test|production), comes from NODE_ENV.name- Application name. Taken frompackage.json.config- Application configuration manager
.cliParams- Parsed CLI parameters.appDir- Application.quadroDir- Location of quadro package.http- HTTP Server reference.koaApp- KOA Application