Guide to configuring dns router
Each domain or subdoman has a configuration object which looks like this:
{
"type": "lookup",
"fallback": {
}
}
type
: explicit - use configuration defied in the file. lookup - lookup in redisfallback
: define a fallback route configuration object explained below.
Route definition object is a configuration object that is used in dns router to handle a request.
auth
: If the route require authenticationroutes
: object containing keys for different request type and route configuration object value
###Route configuration object
type
: possible values:redirect
,display
,action
.redirect
will redirect request to url defined inredirect
. If set todisplay
then controller and action is ignored, returns view (IspreRender
flo invoked and passed to view if present?).action
is default which invokes controller action.view
: path to jade view fileaction
: controller action to invokecontroller
: controller where the action is definedredirect
: URL to redirect iftype
is set toredirect
stack
: middleware stack to run throughpermissions
: array of permission id. If auth is set totrue
then user permission will be checked with allowed permissions.preRender
: flo to invoke before render. Data returned from flo will be passed to view asflodata
objectpostRender
: flo to invoke after render.. use case?viewData
: arbitrary data object passed toreq.instance
{
"auth": false,
"routes": {
"get": {
"type": "",
"action": "",
"controller": "",
"stack": "",
"redirect": "",
"permissions":[],
"postRender": "flo2",
"preRender": "flo1",
"viewData":{}
},
"post": {
"validate": true,
"validationRules": {
"onFail": "Field a is required",
"rule": ""
}
}
}
}
the post Render use case is where the Flo is injected to the page so that it is called upon page load over an ajax call. This would mean that an api.js file be included and on page load the api call will be made asynchronously to this address. This address might require a jwt token to be passed so that permissions can be explicitly invoked through a pre-authed token vs. a system account which has access to everything. This would also allow non-session based handling to occur by simple API injection in the front-end.