title: How do I register my web service with an Angular Router?
body: <p>I have a web service running at <code>:8000/re/myService</code></p>
  
  <p>Before I implemented my router I was able to make my <code>.get</code> calls to <code>myService</code></p>
  
  <p><strong>Get call in service.ts</strong></p>
  
  <pre><code>return await this.http
    .get('/re/myService')
    .toPromise()
    .then(response =&gt; response.json().data as MyObject[])
    .catch(this.handleError);
  </code></pre>
  
  <p>However after the folllowing router was implemented. This call gets a 404.</p>
  
  <p><strong>Error</strong>
  <a href="https://i.stack.imgur.com/97z6R.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/97z6R.png" alt="Error"></a></p>
  
  <p>I'm trying to allow the route by adding it to my routes but it doesn't seem to work </p>
  
  <p><strong>Routes in app.module.ts</strong></p>
  
  <pre><code>const appRoutes: Routes = [
    { path: '', component: HomePageComponent },
    { path: 'details/:id', component: MyComponent1 },
    { path: 're/myService', redirectTo: '/re/myService', pathMatch:'full'},
    {path: '**', redirectTo: ''}
  ];
  </code></pre>
  
  <p><strong>The rest of my ngModule</strong></p>
  
  <pre><code>@NgModule({
    declarations: [
      AppComponent,
      HomePageComponent,
      MyComponent1,
      HeaderComponent
    ],
    imports: [
      BrowserModule,
      FormsModule,
      HttpModule,
      AgGridModule.withComponents(
        [
          ]
      ),
      RouterModule.forRoot(
        appRoutes,
        { enableTracing: true } // &lt;-- debugging purposes only
      )
    ],
    providers: [AppService,AppDetailsService,{provide: APP_BASE_HREF, useValue : '/' }],
    bootstrap: [AppComponent]
  })
  </code></pre>
  
  <p>How can I add my service path to my routes so I can hit my service correctly?</p>