← Home

Elder.js Hook: request

request : This is executed at the beginning the request object being processed.

This hook gives access to the entire state of a request lifecycle before it starts.

  • Primarily used to set 'request' specific data that is required by all routes so doesn't make sense to share across multiple 'data' functions.
  • If you have helper functions that need a closure isolated to a specific page generation lifecycle here is where you should attach them.
  • If you need to programmatically change the route, you can do so here. This is how the elderjs-plugin-random works.
  • This hook is commonly uses by plugins that need to add route level data that is dependent on the request to populate.
Props :
perf
helpers
data
settings
request
allRequests
query
errors
routes
route
Mutable :
errors
helpers
data
settings
request
route
Stable · Location: Page.ts
Elder.js hook Lifecycle