title: "Http failure response for http://localhost:4200/api/: 404 Not Found" Angular 5
body: <p>I start in Angular 5, I want to display the list of Cities from a JAX-RS API, then I get the following error :</p>
  
  <blockquote>
    <p>Http failure response for <a href="http://localhost:4200/api/" rel="nofollow noreferrer">http://localhost:4200/api/</a>: 404 Not Found</p>
  </blockquote>
  
  <p>Here you will find my files with which I work :</p>
  
  <p><strong><em>ville.service.ts</em></strong></p>
  
  <pre><code>import {Injectable} from '@angular/core';
  import { HttpClient, HttpHeaders } from '@angular/common/http';
  
  import { Ville } from '../models/ville.model';
  
  
  const httpOptions = {
    headers: new HttpHeaders({ 'Content-Type': 'application/json' })
  };
  
  @Injectable()
  export class VilleService {
  
    constructor(private http:HttpClient) {}
  
      private userUrl = '/api/';
  
    public getVilles() {
      return this.http.get&lt;Ville[]&gt;(this.userUrl);
    }
  
    public deleteVille(ville) {
      return this.http.delete(this.userUrl + "/"+ ville.idVille);
    }
  
    public createVille(ville) {
      return this.http.post&lt;Ville&gt;(this.userUrl, ville);
    }
  
  }
  </code></pre>
  
  <p><strong><em>proxy.config.json</em></strong></p>
  
  <pre><code>{
      "/api/*": {
        "target": "http://localhost:8080/QuickDep/Compagne",
        "secure": false
      }
    }
  </code></pre>
  
  <p>in <strong><em>package.json</em></strong></p>
  
  <pre><code>"start": "ng serve --proxy-config proxy.config.json",
  </code></pre>