file is commented with all Expresser settings. Please check it for detailed instructions.
How to overwrite Expresser settings
You can overwrite settings in 3 different ways:
- by creating a settings.json file on the root folder of your application.
- by using the
settings.loadFromJson method passing the path to your custom settings file.
- programmatically on your app code.
Please note that when you call the main
, it will automatically look for the
file and use it to override your app settings, so you don't need to do this manually.
Also remember that the Settings class is singleton: if you update a specific setting somewhere, it will reflect on all other parts of your application.
In addition to settings.json
, Expresser will also look for a
file to set per-environment specific settings. That way you can easily create specific settings for different environments (development and production, for example).
Appending custom settings to the Expresser Settings class
You can add as many custom settings as you want and use the Settings class as the main settings repository for your app, as long as you make sure that there are no conflicts between your custom settings keys and the ones used by Expresser. For example you could
add the following "theme" block to the settings.json
and it will be automatically added to the Settings class:
The above theme name for example can be accessed via expresser.settings.theme.name
Resetting to default settings
method will create a new Settings instance and reset all settings to their default initial state. Custom values set programmatically will be cleared out.