createRequestHandler
Creates a request handler for Hydrogen apps. It wraps React Router's request handler and adds Hydrogen-specific functionality such as proxying Storefront API requests, collecting tracking information for analytics, and forwarding cookies to the browser.
Anchor to createrequesthandler(options)createRequestHandler(options)
- Anchor to buildbuildbuildServerBuildServerBuildrequiredrequired
React Router's server build
- Anchor to collectTrackingInformationcollectTrackingInformationcollectTrackingInformationbooleanbooleanDefault: trueDefault: true
Collect tracking information from subrequests such as cookies and forward them to the browser. Disable this if you are not using Hydrogen's built-in analytics.
- Anchor to getLoadContextgetLoadContextgetLoadContext(request: Request) => unknown(request: Request) => unknown
Function to provide the load context for each request. It must contain Hydrogen's storefront client instance for other Hydrogen utilities to work properly.
- Anchor to modemodemodestringstring
React Router's mode
- Anchor to poweredByHeaderpoweredByHeaderpoweredByHeaderbooleanbooleanDefault: trueDefault: true
Whether to include the
powered-byheader in responses.
Was this page helpful?