Skip to content
Source
Sign inSign up
TanStack/router

feat: serverfn abstraction #5040

Mergedschiller-manuel(GitHub profile, opens in a new tab)merged 3 commits intoalpha fromrefs/pull/5040/headmerged by schiller-manuel(GitHub profile, opens in a new tab)

Showing 27 changed files with 49 additions and 0 deletions (loading 23).

x
0 of 27 viewed, 27 left
22 additions and 0 deletionse2e/react-start/server-functions/src/routes/factory/-functions/createBarServerFn.tsAdded
View file
@@ -0,0 +1,22 @@
+import { createMiddleware } from '@tanstack/react-start'
+import { createFooServerFn } from './createFooServerFn'
+​
+const barMiddleware = createMiddleware({ type: 'function' }).server(
+ ({ next }) => {
+ console.log('Bar middleware triggered')
+ return next({
+ context: { bar: 'bar' } as const,
+ })
+ },
+)
+​
+export const createBarServerFn = createFooServerFn().middleware([barMiddleware])
+​
+export const barFnInsideFactoryFile = createBarServerFn().handler(
+ ({ context }) => {
+ return {
+ name: 'barFnInsideFactoryFile',
+ context,
+ }
+ },
+)
5 additions and 0 deletionse2e/react-start/server-functions/src/routes/factory/-functions/createFakeFn.tsAdded
View file
@@ -0,0 +1,5 @@