Skip to main content

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 build
build
ServerBuild
required

React Router's server build

Anchor to collectTrackingInformation
collectTrackingInformation
boolean
Default: 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 getLoadContext
getLoadContext
(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.

string

React Router's mode

Anchor to poweredByHeader
poweredByHeader
boolean
Default: true

Whether to include the powered-by header in responses.



Was this page helpful?