Methods
-
<static> getQueryRoutingConfigs(renderProps)
-
Looks up all
configs on the currently matched routes. Parameters:
Name Type Description renderPropsObject The main route matching result
- Source:
Returns:
An object of query routing configurations mapped by query parameter name
- Type
- Object
-
<async> handleRequest(req, res, next, options [, debugMode])
-
Handles incoming request from the express app. Will use renderPage() to do the actual page rendering. Catches any errors that occur and calls express' res.redirect() or next() accordingly.
Parameters:
Name Type Argument Default Description reqObject The express request object
resObject The express response object
nextfunction The express next callback
optionsObject Options object
Properties
Name Type Argument Default Description authHelperAuthenticationHelper <optional>
null If authentication is enabled for this server, an instance of AuthenticationHelper will be passed so authentication can be performed on routes that require login
afterStoreHookfunction <optional>
null Optional hook function that is called after the store is created, so it can dispatch actions or subscribe to changes from outside this function. The store will be passed as the first and only parameter to the hook function.
debugModeboolean <optional>
false If debug mode is enabled, will run respond with a json with additional metadata instead of the response content as HTML.
- Source:
-
<async> matchRoutes(req, res)
-
Performs a react-router match() call against the incoming express request. Will execute a redirect if a redirect is returned from the match.
Parameters:
Name Type Description reqObject The express request object
resObject The express response object
- Source:
Returns:
A Promise that resolves with the renderProps properties if the route was matched. Returns null otherwise.
- Type
- Promise
-
<async> renderPage(req, res, options [, debugProps])
-
Handles incoming request from the express app. Will match the requested route using react-router and if a match has been found, render the markup for that route and respond it back to the client.
Parameters:
Name Type Argument Default Description reqObject The express request object
resObject The express response object
optionsObject Options object
Properties
Name Type Argument Default Description authHelperAuthenticationHelper <optional>
null If authentication is enabled for this server, an instance of AuthenticationHelper will be passed so authentication can be performed on routes that require login
afterStoreHookfunction <optional>
null Optional hook function that is called after the store is created, so it can dispatch actions or subscribe to changes from outside this function. The store will be passed as the first and only parameter to the hook function.
debugPropsObject <optional>
null If debug mode is enabled, this will be an object where additional diagnostics will be pushed onto
- Source: