API Docs for: 0.8.0
Show:

Middleware Class

Provides the set of default middleware.

Methods

authorizationCheck

(
  • req
  • res
  • next
)
static

Responsible for ensuring that the entity that is sending the request has proper authorization to access the request resource. First a role check is made and if that passes then permissions are examined. When the authorization check fails a 403 FORBIDDEN error is thrown

Parameters:

  • req Request

    The current request to process

  • res Response

    The response object that compliments the current request

  • next Function

    (Error) Callback function that takes a single parameter, an error if it occurred

checkPublicRoute

(
  • req
  • res
  • next
)
static

Looks to see if the incoming route maps to a public resource

Parameters:

  • req Request

    The current request to process

  • res Response

    The 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
)
static

Looks up the active theme

Parameters:

  • req Request

    The current request to process

  • res Response

    The 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
)
static

Extracts path variables out of the route's path and assigns them to the request instances "pathVars" variable

Parameters:

  • req Request

    The current request to process

  • res Response

    The 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
)
static

Looks up the current route based on the incoming URL

Parameters:

  • req Request

    The current request to process

  • res Response

    The 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
)
static

Derives the route theme

Parameters:

  • req Request

    The current request to process

  • res Response

    The 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
)
static

Derives the intended site based on hostname of the incoming request

Parameters:

  • req Request

    The current request to process

  • res Response

    The 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
)
static

Responsible for emitting the route theme retrieved event.

Parameters:

  • req Request

    The current request to process

  • res Response

    The 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:

Array:

inactiveAccessCheck

(
  • req
  • res
  • next
)
static

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 Request

    The current request to process

  • res Response

    The 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
)
static

Takes the controller instance and calls the "init" function to ensure the controller is ready to render the result

Parameters:

  • req Request

    The current request to process

  • res Response

    The 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
)
static

Instantiates an instance of the controller that maps to the derived route based on the active site, theme, and HTTP method combination.

Parameters:

  • req Request

    The current request to process

  • res Response

    The 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
)
static

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 Request

    The current request to process

  • res Response

    The 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
)
static

Responsible for parsing the incoming request body

Parameters:

  • req Request

    The current request to process

  • res Response

    The 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
)
static

Derives the principal for the request based on the incoming cookie

Parameters:

  • req Request

    The current request to process

  • res Response

    The 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
)
static

Closes the session by persisting it back to the session store.

Parameters:

  • req Request

    The current request to process

  • res Response

    The 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
)
static

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 Request

    The current request to process

  • res Response

    The 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
)
static

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 Request

    The current request to process

  • res Response

    The 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
)
static

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 Request

    The current request to process

  • res Response

    The 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
)
static

Responsible for setting the start time for the request

Parameters:

  • req Request

    The current request to process

  • res Response

    The 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
)
static

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 Request

    The current request to process

  • res Response

    The 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
)
static

Parses the incoming URL

Parameters:

  • req Request

    The current request to process

  • res Response

    The 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
)
static

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 Request

    The current request to process

  • res Response

    The 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
)
static

When no cookie is detected for the current request this middleware writes the session cookie to the response

Parameters:

  • req Request

    The current request to process

  • res Response

    The response object that compliments the current request

  • next Function

    (Error) Callback function that takes a single parameter, an error if it occurred

Properties

DEFAULT_MIDDLEWARE

String private static