Skip to content

fix(start): redirect from api-routes to server-routes #430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion app/libraries/start.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Library } from '.'
import { redirect } from '@tanstack/react-router'

export const startProject: Library = {
id: 'start',
name: 'TanStack Start',
cardStyles: `shadow-xl shadow-cyan-500/20 dark:shadow-lg dark:shadow-cyan-500/30 text-cyan-500 dark:text-white-400 border-2 border-transparent hover:border-current`,
to: '/start',
tagline: `Full-stack React Framework powered by TanStack Router`,
description: `Full-document SSR, Streaming, Server Functions, bundling and more, powered by TanStack Router, Vinxi, and Nitro and ready to deploy to your favorite hosting provider.`,
description: `Full-document SSR, Streaming, Server Functions, bundling and more, powered by TanStack Router and ready to deploy to your favorite hosting provider.`,
bgStyle: 'bg-cyan-500',
textStyle: 'text-cyan-500',
badge: 'alpha',
Expand All @@ -19,4 +20,13 @@ export const startProject: Library = {
textColor: 'text-cyan-600',
frameworks: ['react'],
scarfId: 'b6e2134f-e805-401d-95c3-2a7765d49a3d',
handleRedirects: (href) => {
if (
href.match(/\/start\/latest\/docs\/framework\/(react|solid)\/api-routes/)
) {
throw redirect({
href: href.replace('/api-routes', '/server-routes'),
})
}
},
}