T
TanStack2mo ago
deep-jade

Setting request headers

Hi, how do I set the request headers so that I can pass an Authorization token in requests to server functions?
4 Replies
wise-white
wise-white2mo ago
Middleware | TanStack Start React Docs
What is Server Function Middleware? Middleware allows you to customize the behavior of server functions created with createServerFn with things like shared validation, context, and much more. Middlewa...
wise-white
wise-white2mo ago
Using middleware
deep-jade
deep-jadeOP2mo ago
Perfect, thank you! How do I register the global middleware? I have a global-middleware.ts file but I'm not using app/ as a directory. Ah, adding it to __root worked
wise-white
wise-white2mo ago
Yeah I think it used to auto pick it up but not anymore

Did you find this page helpful?