title: Can't get data from my express server api?
body: <p>My localhost http://localhost:3001/read is an API which is working but in my front end I can not get any data from the API:</p>
  <p>my express app.js</p>
  <pre><code>app.get('/read', async (req, res) =&gt; {
  Diary.find({}).exec((err, data) =&gt; {  //Diary is my mongodb collection
  if (err) return res.status(400).send(err);
  if (data) res.status(200).send(data)
  })
  })
  </code></pre>
  <p>my frontend using react js:</p>
  <pre><code>useEffect(() =&gt; {
  axios.get(&quot;http://localhost:3001/read&quot;).then((data)=&gt;{
  console.log(data)
  }).catch((e)=&gt;{
  console.log(e)
  })
  })
  </code></pre>
  <p>Result: GET http://localhost:3001/read 400 (Bad Request)</p>