Skip to content

Latest commit

 

History

History
235 lines (179 loc) · 9.05 KB

api.md

File metadata and controls

235 lines (179 loc) · 9.05 KB

Modules

periodic

Periodic is an application framework for building enterprise javascript applications.

Functions

configureLowkie()Promise

configureLowkie creates a loki connection to store DB based configurations

configureMongoose()Promise

configureMongoose creates a mongo connection to store DB based configurations

configureSequelize()Promise

configureSequelize creates a mongo connection to store DB based configurations

loadConfiguration()

reads content/config/(config.json||config.js) for the configuration database

startTimer()

Starts intialization console timer

endTimer()

Ends initialization console timer

configureViews()Promise

configure express view rendering options

initializeExpress()Promise

sets the runtime environment correctly

setUpFolderStructure()

this will setup a periodic application folder structure if one doesnt exist, it will not overwrite existing configs

configureLogger()Promise

configures winston

getEnv(argv)string | boolean

get the application environment from command line arguments

setAppRunningEnv(env, operation, processRuntimeConfig)boolean | Promise

sets the application runtime environment and save last run environment into configuration

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

_route_prefix(adminPath)String

returns a string that's used in an express router that's always prefixed with a preceding '/'

_admin_prefix(adminPath)String

returns a route string without the precending '/'

_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

all_prefixes(adminPath)String

short hand function to return all prefix types

formatResponse()object

Enforces the shape of an api response, by allow for three properties (result,status and data) all other properties are on data

periodic

Periodic is an application framework for building enterprise javascript applications.

configureLowkie() ⇒ Promise

configureLowkie creates a loki connection to store DB based configurations

Kind: global function
Returns: Promise - connects to configuration db

configureMongoose() ⇒ Promise

configureMongoose creates a mongo connection to store DB based configurations

Kind: global function
Returns: Promise - connects to configuration db

configureSequelize() ⇒ Promise

configureSequelize creates a mongo connection to store DB based configurations

Kind: global function
Returns: Promise - connects to configuration db

loadConfiguration() ⇒

reads content/config/(config.json||config.js) for the configuration database

Kind: global function
Returns: Promise loadConfiguration sets up application config db

startTimer() ⇒

Starts intialization console timer

Kind: global function
Returns: Promise

endTimer() ⇒

Ends initialization console timer

Kind: global function
Returns: Promise

configureViews() ⇒ Promise

configure express view rendering options

Kind: global function

initializeExpress() ⇒ Promise

sets the runtime environment correctly

Kind: global function
Returns: Promise - configRuntimeEnvironment sets up application config db

setUpFolderStructure() ⇒

this will setup a periodic application folder structure if one doesnt exist, it will not overwrite existing configs

Kind: global function
Returns: Promise setUpFolderStructure will copy folders from the application __STRUCTURE directory to initialize the application

configureLogger() ⇒ Promise

configures winston

Kind: global function
Returns: Promise - configureLogger sets up winston

getEnv(argv) ⇒ string | boolean

get the application environment from command line arguments

Kind: global function
Returns: string | boolean - returns the value of the enviroment or false

Param Type Description
argv any parsed command line arguments

setAppRunningEnv(env, operation, processRuntimeConfig) ⇒ boolean | Promise

sets the application runtime environment and save last run environment into configuration

Kind: global function
Returns: boolean | Promise - returns a resolved promise after configuration database operation

Param 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

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

Kind: global function
Returns: Promise - configRuntimeEnvironment sets up application config db

_route_prefix(adminPath) ⇒ String

returns a string that's used in an express router that's always prefixed with a preceding '/'

Kind: global function
Returns: String - route used for express router, that's always prefixed with a "/"

Param Type
adminPath String

_admin_prefix(adminPath) ⇒ String

returns a route string without the precending '/'

Kind: global function

Param Type
adminPath 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

Kind: global function

Param Type
adminPath String

all_prefixes(adminPath) ⇒ String

short hand function to return all prefix types

Kind: global function

Param Type
adminPath String

formatResponse() ⇒ object

Enforces the shape of an api response, by allow for three properties (result,status and data) all other properties are on data

Kind: global function
Returns: object - with the shape {result,status,data}

Param 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