shared-config
Configuration shared by browser and server.
Installation
Using npm:
npm install shared-config
Using component:
component install shared-config
Usage
Configuration files are loaded from config/
in your application directory,
or from process.env.NODE_CONFIG_PATH
if set.
Configuration files can be json, yaml, or modules. config/default.ext
is
loaded first, extended with config/<process.env.NODE_ENV>.ext
if it exists,
and finally extended with config/local.ext
if it exists.
Require the configuration on your server and then send to the client by setting
the config
cookie.
config/default.yaml
:
api: url: 'https://api.example.com'
Server:
var config = ; app ;
Browser:
var config = ; console;// => { url: 'https://api.example.com' }