1.0.0 • Published 4 years ago

ucoach-scaffold v1.0.0

Weekly downloads
9
License
-
Repository
-
Last release
4 years ago

#Installation

//add to package.json prior to npm install
"ucoach-scaffold": "git+https://github.com/inside-track/ucoach-scaffold.git"

#ucoach-scaffold Scaffolding for any api or web application. Handles logging, http(s) requests, routing validation for primative types string, int, number, date, array, json. Complex comparisons like json or item inspection of a collection should be validated externally. Meaning implemented in the extension function onRouteValidation.

#onUncaughtExceptionRequest A hook for any external handling of process failure api core will kill process.

#onPreAppSetup Anything that needs to be done prior to anything added to the express app.

#onPreAppMiddleware Anything added prior to adding middleware this could also be done in onPreAppSetup.

#onPostAppMiddleware Anything added after middleware.

#onPreRouterConfigured Anything added before configuring the routing this could also be done in onPostAppMiddleware.

#onPostRouterConfigured Anything added after router has been configured.

#onRouteValidation During route validation this will be called first(parameters marked as external validated prior as default check if all are accounted for).

#onRouteDataRequest A hook to get data default handle response will still send this out yet for web application is preferred to use override onHandleResponse.

#onHandleResponse A hook to handle response.send as default will only send json or write data directly to response.

#Encryption an encryption module is added to api that is configurable default is aes-256-ctr

#log4js a logger is also attached with an internal raygun client. Global keys are configurable raygun will require EXCEPTION_RERPORTER_KEY

#ServiceManager service resolves will require that services are passed so when the manager attempts to configure the service contract it can resolve them correctly

#Globals Any global values should be added during the callback of onSetup where the initial access to globals will be provided.

route validation

Default routing validation will check and convert the following types via the javascript-validator

type:               function:
string              isString
string-non-empty    isNonEmptyString
string-date         isDateString
string-numeric      isNumericString
int                 isInt
number              isNumber
//for json.stringify dates it has to convert as isDateString will be false
date                isDate
//has to json.parse prior to checking
array               isArray
//has tojson.parse prior to checking
json                isObject