title: not able to send request to express server using axios
body: <p>I am building a chat application like whatsapp, &amp; implementing the feature - when user clicks on any person's name, his chats appears, but can't able to send request to server when user clicks</p>
  <p><a href="https://github.com/bhupesh8222/ChatApplication" rel="nofollow noreferrer">Source code</a></p>
  <p>There is div, when user will click on it, it will fetch data from server (onclick event handler) in <a href="https://github.com/bhupesh8222/ChatApplication/blob/master/client/src/Sidebar.js" rel="nofollow noreferrer">Sidebar.js file - </a></p>
  <pre><code>{friends.map((e) =&gt; (
                      &lt;div
                          onClick={getChatDetails}
                          key={e.friendName}
                          className='sidebar_chat_info'&gt;
                          &lt;Avatar /&gt;
                          &lt;div&gt;
                              &lt;h2&gt;{e.friendName}&lt;/h2&gt;
                              &lt;p&gt;{getLastMessage()}&lt;/p&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  ))}
  </code></pre>
  <p>this is getChatDetails function in sidebar.js file</p>
  <pre><code>const getChatDetails = (e) =&gt; {
      //console.log(e.target.textContent);
      const Myfriend = e.target.textContent;
      axios
          .post('http://localhost:2000/message/get', { friend: Myfriend })
          .then((response) =&gt; {
              console.log(response);
          })
          .catch((error) =&gt; console.log(error));
  };
  </code></pre>
  <p>At the server side , this is route in <a href="https://github.com/bhupesh8222/ChatApplication/blob/master/server/index.js" rel="nofollow noreferrer">index.js file</a></p>
  <p>Server is running on port 2000</p>
  <pre><code>app.post('/message/get', isloggedIn, async (req, res) =&gt; {
  console.log('REQUESTED!');
  
  try {
      const conversation = await req.user.MyConversation.find(
          (element) =&gt; element.friendName == req.body.friend
      );
      const messages = await conversationModel.findById(conversation.chats);
      res.send(messages);
      //await MessageModel.remove({})
  } catch (error) {
      res.status(500).send(error);
  }
  });
  </code></pre>
  <p><a href="https://drive.google.com/file/d/1aFx_RVqqHALB6APpFfyH-zr7_z5-0Or7/view?usp=sharing" rel="nofollow noreferrer">This is error on browser console , when I am clicking on div</a></p>
  <p><a href="https://drive.google.com/file/d/1IAqnuPJfI8c6pMFyJAU2C4tJd2eUvhuE/view?usp=sharing" rel="nofollow noreferrer">But when I am sending request through postman, I am getting response </a></p>
  <p>When I am sending request in other files (login.js), it's working there, don't know why it is not working only Sidebar.js file</p>