Skip to content

Commit ba7a9e8

Browse files
fix(start): add redirects to throw from /api-routes to /server-routes (#430)
Co-authored-by: Sean Cassiere <[email protected]>
1 parent 085bb1d commit ba7a9e8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/libraries/start.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { BiBookAlt } from 'react-icons/bi'
55
import { PiRocketLaunchDuotone, PiTreeStructureBold } from 'react-icons/pi'
66
import { TbServerBolt } from 'react-icons/tb'
77
import { twMerge } from 'tailwind-merge'
8+
import { redirect } from '@tanstack/react-router'
89

910
const repo = 'tanstack/router'
1011

@@ -150,4 +151,16 @@ export const startProject = {
150151
),
151152
},
152153
],
154+
handleRedirects: (href) => {
155+
// Redirect from /api-routes to /server-routes
156+
if (
157+
href.match(
158+
/\/start\/(latest|v1)\/docs\/framework\/(react|solid)\/api-routes/
159+
)
160+
) {
161+
throw redirect({
162+
href: href.replace('/api-routes', '/server-routes'),
163+
})
164+
}
165+
},
153166
} satisfies Library

0 commit comments

Comments
 (0)