title: Post request problem with nextjs and axios
body: <p>I'm coming from the "Java world" and creating a small web program for the first time with: NextJS, React, Postgres and axios.</p>
  
  <p>When I create the Login/Signin pages, I succesed to communicate with the server and send with post requests.</p>
  
  <p>My problem is when I tried to send the post messages outside the render() of react, Its send the route without the url host, and the server doesnt get the post request. <strong>(When i send the post request with Postman its working).</strong></p>
  
  <p>I know it's a server/client sending requests problem , but I've been sitting on it for a few days and can not solve the problem.</p>
  
  <p>So here is a limited repo of my web program: <a href="https://github.com/idonava/react-next-program-example" rel="nofollow noreferrer">https://github.com/idonava/react-next-program-example</a></p>
  
  <p><strong>SignIn - working post request flow:</strong></p>
  
  <ol>
  <li><em>pages/signin.js</em> handleSubmit -> signIn (line 103).</li>
  <li><em>libs/auth.js</em> signIn-> authenticate (line 16).</li>
  <li><em>services/authApi.js</em> authenticate-> post(line 6).</li>
  <li><em>services/requets.js</em> post send request via axios(line 8).</li>
  <li>After that - the server get the post request, return answer to the client and the user login succesfully</li>
  </ol>
  
  <p><strong>Getting the user id- NOT working post request flow:</strong></p>
  
  <ol>
  <li><em>pages/flickr.js</em> getInitialProps -> getUser (line 15).</li>
  <li><em>libs/user.js</em> getUser-> getCurrentUser (line 4).</li>
  <li><em>services/authApi.js</em> getCurrentUser-> post(line 26).</li>
  <li><em>services/requets.js</em> post send request via axios(line 8).</li>
  <li>the server doesnt get to post request, And it look like the url is "/routing/getuser" instead of "localhost:3100/routing/getuser".</li>
  </ol>
  
  <p>notes:</p>
  
  <ul>
  <li>The program run locally on localhost:3100.</li>
  <li>The server listening for the request on <em>server.js</em> -> <em>routing/index.js</em> -> <em>db/models/user</em>.</li>
  </ul>
  
  <p>I'd be happy to get help with that.
  Thanks a lot !!</p>