Skip to content

storageRoutes

storageRoutes(options): RouteConfigEntry[]

Defined in: packages/storage/src/plugin.ts:83

Build the React Router route-config entries that mount the /uploads/* proxy + upload endpoint. The returned array is meant to be spread into the user’s routes.ts default export.

The single splat route dispatches on HTTP method inside the handler file:

  • GET /uploads/<key> — streams the R2 object at key, optionally gated by a signed token or an ownerCheck function.
  • POST /uploads/<filetype> — uploads a multipart file for the named filetype, returning { key, url }.

StorageRoutesOptions

Handler file location and (optional) base path.

RouteConfigEntry[]

One or more RouteConfigEntry objects.