title: Fetch data from local API
body: <p>I have a simple API with symfony, run on <a href="http://127.0.0.1:8000" rel="nofollow noreferrer">http://127.0.0.1:8000</a> and a React project who run on http://localhost:3000.</p>
  <p>I want to get this :</p>
  <pre class="lang-json prettyprint-override"><code>{&quot;0&quot;:{&quot;id&quot;:51,&quot;nom&quot;:&quot;Ouais&quot;,&quot;prenom&quot;:&quot;ssdds&quot;,&quot;competences&quot;:{}},&quot;1&quot;:{&quot;id&quot;:52,&quot;nom&quot;:&quot;Ouais&quot;,&quot;prenom&quot;:&quot;ssdds&quot;,&quot;competences&quot;:{}},&quot;2&quot;:{&quot;id&quot;:53,&quot;nom&quot;:&quot;Alexis&quot;,&quot;prenom&quot;:&quot;un truc&quot;,&quot;competences&quot;:{}}}
  </code></pre>
  <p>URL = <a href="http://127.0.0.1:8000/api/collaborateurs" rel="nofollow noreferrer">http://127.0.0.1:8000/api/collaborateurs</a></p>
  <p>So, in react i do :</p>
  <pre class="lang-js prettyprint-override"><code>import React, { Component } from &quot;react&quot;;
  import './App.css';
  
  fetch('/api/collaborateurs')
      .then(response =&gt; console.log(response))
      .then(json =&gt; console.log(json))
  
  class App extends Component {
  
      render() {
      return (&lt;div className=&quot;App&quot;&gt;
          &lt;h1&gt;Salope&lt;/h1&gt;
      &lt;/div&gt;)
      }
  }
  
  export default App;
  </code></pre>
  <p>but</p>
  <pre><code>console.log(response)
  </code></pre>
  <p>return :</p>
  <pre><code>Response {type: &quot;basic&quot;, url: &quot;http://localhost:3000/api/collaborateurs&quot;, redirected: false, status: 200, ok: true, …}
  body: (...)
  bodyUsed: false
  headers: Headers {}
  ok: true
  redirected: false
  status: 200
  statusText: &quot;OK&quot;
  type: &quot;basic&quot;
  url: &quot;http://localhost:3000/api/collaborateurs&quot;
  __proto__: Response
  </code></pre>
  <p>why url: &quot;http://localhost:3000/api/collaborateurs&quot; i want url: &quot;**<a href="http://127.0.0.1:8000**/api/collaborateurs%22" rel="nofollow noreferrer">http://127.0.0.1:8000**/api/collaborateurs&quot;</a></p>
  <p>if i change fetch('/api/collaborateurs') to fetch('http://127.0.0.1/api/collaborateurs') the console.log not working</p>
  <p>Thank you</p>