analogjs / analog

The fullstack meta-framework for Angular. Powered by Vite and Nitro
https://analogjs.org
MIT License
2.5k stars 240 forks source link

[DOCS]: document using routeMeta to redirect to a default path #269

Closed AdditionAddict closed 1 year ago

AdditionAddict commented 1 year ago

Intended PR after '## Route Metadata' section and code


Redirect to a default route

To redirect to the route /dashboard from /, define redirectTo and pathMatch inside src/app/routes/index.ts:

import { RouteMeta } from '@analogjs/router';

export const routeMeta: RouteMeta = {
  redirectTo: '/dashboard',
  pathMatch: 'full',
};

Or is there a preference to keep using parenthesis index route like src/app/routes/(redirect).ts?

brandonroberts commented 1 year ago

Interesting convention around the (redirect).ts. I think the index.ts would be clearer, as you don't have to name it (redirect) for it to work