Thursday, 27 April 2017

Mean Stak: set defuault path

where i can set the default path for a Mean Stack Application? Local path is

http://localhost:3000

but i'd like the application starts at

http://localhost:3000/myapp/

In my mind i would expect my routing won't change:

const appRoutes: Routes = [
  { path: '', component: HomeComponent, pathMatch: 'full', canActivate: [AuthGuard] },
  { path: 'login', component: AuthComponent },
  { path: 'register', component: RegisterComponent },
  // otherwise redirect to home
  { path: '**', redirectTo: '' }
];

When i deploy on my server i want to have my application running on port 80 and in its separated context, like this:

http://www.myserver.com/myapp/

the routing sounds like this:

http://www.myserver.com/myapp/home
http://www.myserver.com/myapp/login

and if i point on a not set route:

http://www.myserver.com/myapp/notexists

it redirects on its base:

http://www.myserver.com/myapp/

thanks in advance.



via Max Bertoli

No comments:

Post a Comment