All files / src server.ts

0% Statements 0/4
100% Branches 0/0
0% Functions 0/4
0% Lines 0/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20                                       
// The Worker's server entry: TanStack Start's handler wrapped in Paraglide's
// middleware, which resolves the request's language (project.inlang/
// paraglide.config.ts) so getLocale() and messages use it during SSR, and in
// the request's trace, which logs it (platform/request.server.ts). Bodies
// over MAX_REQUEST_BYTES are refused before the app reads them.
import handler from '@tanstack/react-start/server-entry'
import { paraglideMiddleware } from './paraglide/server.js'
import { MAX_REQUEST_BYTES, withBodyLimit } from './server/platform/body.server'
import { handleTraced } from './server/platform/request.server'
 
export default {
  fetch(request: Request): Promise<Response> {
    return handleTraced(request, () =>
      withBodyLimit(request, MAX_REQUEST_BYTES, (limited) =>
        paraglideMiddleware(limited, () => handler.fetch(limited)),
      ),
    )
  },
}