title: Nodejs REST API to rewrite url or work as middleware for accessing distant photos
body: <p>I am making a rest api with node/express for exposing data with assests urls from another servers , like this : </p>
  
  <pre><code> Client ------&gt; RestAPI with nodeJs/express (API Y) --------&gt; API for Images (API X)
  </code></pre>
  
  <ul>
  <li>The API for Images (API X): provide json or links for images with url like "<a href="http://APIX.com/link1/X.jpg" rel="nofollow noreferrer">http://APIX.com/link1/X.jpg</a>"</li>
  <li>The assets / images are located in (API X) server .</li>
  </ul>
  
  <p>What am trying to do is when the client calls the (API Y) and want to get data with image urls like "<a href="http://APIY.com/api/X.jpg" rel="nofollow noreferrer">http://APIY.com/api/X.jpg</a>" ,the (API Y) fetch the images from (API X) and return it to client with links from (API Y), so the client will not know the correct source of images and think that the images are hosted in (API Y) server.</p>
  
  <p>Any idea on how can i implement this in NODE js/express ? thx.</p>