title: I am having problem using http-proxy-middleware
body: <p>I have two servers running in my backend, because of that I have to use the <a href="https://www.npmjs.com/package/http-proxy-middleware#shorthand" rel="nofollow noreferrer">http-proxy-middleware</a> package but I am encountering some problems.</p>
  <p>This is my code in the frontend which is running on localhost:3000</p>
  <pre><code>axios(&quot;/api2/login&quot;,data)
      .then((res) =&gt; {
  });
  </code></pre>
  <p>This is my code in the backend which is running on localhost:5001</p>
  <pre><code>const { createProxyMiddleware } = require('http-proxy-middleware');
  
  app.use(createProxyMiddleware('/api2', {target: 'http://localhost:5001', changeOrigin: true}))
  
  app.post(&quot;/login&quot;, (req, res, next) =&gt; {
      res.send(&quot;Logged In&quot;);
  });
  </code></pre>
  <p>This code is no working showing this error in the browser's console</p>
  <pre><code>GET http://localhost:3000/api2/login 404 (Not Found)
  Uncaught (in promise) Error: Request failed with status code 404
      at createError (createError.js:16)
      at settle (settle.js:17)
      at XMLHttpRequest.handleLoad (xhr.js:61)
  </code></pre>
  <p>I am not able to understand where I am going wrong.</p>