Middleware Class
Provides the set of default middleware.
Item Index
Methods
- authorizationCheck static
- checkPublicRoute static
- deriveActiveTheme static
- derivePathVariables static
- deriveRoute static
- deriveRouteTheme static
- deriveSite static
- emitRouteThemeRetrieved static
- getAll static
- inactiveAccessCheck static
- initializeController static
- instantiateController static
- localizedRouteCheck static
- parseRequestBody static
- principal static
- principalClose static
- render static
- requiresAuthenticationCheck static
- responseTime static
- startTime static
- systemSetupCheck static
- urlParse static
- writeResponse static
- writeSessionCookie static
Properties
- DEFAULT_MIDDLEWARE static
Methods
checkPublicRoute
-
req
-
res
-
next
Looks to see if the incoming route maps to a public resource
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
deriveActiveTheme
-
req
-
res
-
next
Looks up the active theme
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
derivePathVariables
-
req
-
res
-
next
Extracts path variables out of the route's path and assigns them to the request instances "pathVars" variable
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
deriveRoute
-
req
-
res
-
next
Looks up the current route based on the incoming URL
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
deriveRouteTheme
-
req
-
res
-
next
Derives the route theme
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
deriveSite
-
req
-
res
-
next
Derives the intended site based on hostname of the incoming request
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
emitRouteThemeRetrieved
-
req
-
res
-
next
Responsible for emitting the route theme retrieved event.
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
getAll
()
Array
static
Retrieves all of the default middleware.
Returns:
inactiveAccessCheck
-
req
-
res
-
next
Determines whether or not the request can be made against an inactive site. If the site is global and the route does not allow inactive access then the entity is redirected to the admin section. Otherwise, if the site is not global then a Not Found error is found.
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
initializeController
-
req
-
res
-
next
Takes the controller instance and calls the "init" function to ensure the controller is ready to render the result
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
instantiateController
-
req
-
res
-
next
Instantiates an instance of the controller that maps to the derived route based on the active site, theme, and HTTP method combination.
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
localizedRouteCheck
-
req
-
res
-
next
Responsible for determining if the route is localized. If the derived site does not support the locale inside of the route path the middleware will throw a Not Found error
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
parseRequestBody
-
req
-
res
-
next
Responsible for parsing the incoming request body
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
principal
-
req
-
res
-
next
Derives the principal for the request based on the incoming cookie
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
principalClose
-
req
-
res
-
next
Closes the session by persisting it back to the session store.
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
render
-
req
-
res
-
next
Responsible for taking the initialized controller and executing its rendering handler. The result of the rendering is set on the request object as "controllerResult".
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
requiresAuthenticationCheck
-
req
-
res
-
next
Responsible for ensuring that the entity that is sending the request has been authenticated. When the check fails a 401 NOT AUTHORIZED is thrown
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
responseTime
-
req
-
res
-
next
Responsible for calculating the time the server took to respond. The result will be logged if the log level is debug or silly
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
startTime
-
req
-
res
-
next
Responsible for setting the start time for the request
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
systemSetupCheck
-
req
-
res
-
next
Verifies that the system has already gone through the setup process. When the check fails the system is redirected to the setup page
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
urlParse
-
req
-
res
-
next
Parses the incoming URL
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
writeResponse
-
req
-
res
-
next
Responsible for writing the result of the request to the response stream. When the result contains a redirect parameter the middleware assumes that the controller result was a redirect result and creates a redirect response
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred
writeSessionCookie
-
req
-
res
-
next
When no cookie is detected for the current request this middleware writes the session cookie to the response
Parameters:
-
req
RequestThe current request to process
-
res
ResponseThe response object that compliments the current request
-
next
Function(Error) Callback function that takes a single parameter, an error if it occurred