Methods
_admin_prefix(adminPath) → {String}
returns a route string without the precending '/'
Parameters:
Name | Type | Description |
---|---|---|
adminPath |
String |
- Source:
Returns:
- Type
- String
_manifest_prefix(adminPath) → {String}
returns a route string that always has a preceding '/' and a suffixed '/', this is typically used for specifiying links to paths as absolute urls
Parameters:
Name | Type | Description |
---|---|---|
adminPath |
String |
- Source:
Returns:
- Type
- String
_route_prefix(adminPath) → {String}
returns a string that's used in an express router that's always prefixed with a preceding '/'
Parameters:
Name | Type | Description |
---|---|---|
adminPath |
String |
- Source:
Returns:
route used for express router, that's always prefixed with a "/"
- Type
- String
all_prefixes(adminPath) → {String}
short hand function to return all prefix types
Parameters:
Name | Type | Description |
---|---|---|
adminPath |
String |
- Source:
Returns:
- Type
- String
configRuntimeEnvironment() → {Promise}
sets the runtime environment correctly, there are multiple ways to set the runtime environment (via command line arguments, or via environment variables)
It will prioritize loading via command line argument first, and then environment variables, and finally it will use the last runtime environment
- Source:
Returns:
configRuntimeEnvironment sets up application config db
- Type
- Promise
configureLogger() → {Promise}
configures winston
- Source:
Returns:
configureLogger sets up winston
- Type
- Promise
configureLowkie() → {Promise}
configureLowkie creates a loki connection to store DB based configurations
- Source:
Returns:
connects to configuration db
- Type
- Promise
configureMongoose() → {Promise}
configureMongoose creates a mongo connection to store DB based configurations
- Source:
Returns:
connects to configuration db
- Type
- Promise
configureSequelize() → {Promise}
configureSequelize creates a mongo connection to store DB based configurations
- Source:
Returns:
connects to configuration db
- Type
- Promise
configureViews() → {Promise}
configure express view rendering options
- Source:
Returns:
- Type
- Promise
endTimer()
Ends initialization console timer
- Source:
Returns:
Promise
formatResponse() → {object}
Enforces the shape of an api response, by allow for three properties (result,status and data) all other properties are on data
Parameters:
Name | Type | Description |
---|---|---|
options.result |
string | result of request (usually sucess or error) |
options.status |
number | http resonse code equivalent |
options.data |
object | data for response |
- Source:
Returns:
with the shape {result,status,data}
- Type
- object
getEnv(argv) → {string|boolean}
get the application environment from command line arguments
Parameters:
Name | Type | Description |
---|---|---|
argv |
any | parsed command line arguments |
- Source:
Returns:
returns the value of the enviroment or false
- Type
- string | boolean
handler() → {object}
this is the proxy handler for periodic, provides access to native expess methods as well.
- Source:
Returns:
- Type
- object
initializeExpress() → {Promise}
sets the runtime environment correctly
- Source:
Returns:
configRuntimeEnvironment sets up application config db
- Type
- Promise
loadConfiguration()
reads content/config/(config.json||config.js) for the configuration database
- Source:
Returns:
Promise loadConfiguration sets up application config db
setAppRunningEnv(env, operation, processRuntimeConfig) → {boolean|Promise}
sets the application runtime environment and save last run environment into configuration
Parameters:
Name | Type | Description |
---|---|---|
env |
any | this is the enviroment variable to set |
operation |
string | either update the config db, or create a new entry for process.runtime |
processRuntimeConfig |
object | existing runtime config from configuration database |
- Source:
Returns:
returns a resolved promise after configuration database operation
- Type
- boolean | Promise
setUpFolderStructure()
this will setup a periodic application folder structure if one doesnt exist, it will not overwrite existing configs
- Source:
Returns:
Promise setUpFolderStructure will copy folders from the application __STRUCTURE directory to initialize the application
startTimer()
Starts intialization console timer
- Source:
Returns:
Promise