paraglideMiddleware()
paraglideMiddleware<
T>(request,resolve,callbacks?):Promise<Response>
Defined in: server/middleware.js:64
Server middleware that handles locale-based routing and request processing.
This middleware performs several key functions:
- Determines the locale for the incoming request using configured strategies
- Handles URL localization and redirects (only for document requests)
- Maintains locale state using AsyncLocalStorage to prevent request interference
When URL strategy is used:
- The locale is extracted from the URL for all request types
- If URL doesn't match the determined locale, redirects to localized URL (only for document requests)
- De-localizes URLs before passing to server (e.g.,
/fr/about→/about)
Type Parameters
T
T
The return type of the resolve function
Parameters
request
Request
The incoming request object
resolve
(args) => T | Promise<T>
Function to handle the request
callbacks?
Callbacks to handle events from middleware
onRedirect
(response) => void
Returns
Promise<Response>


