title: How to receive a res.send(req.body) when send back to a function
body: <p>I am trying to send the req.body on a POST request route back to the function executing the POST request.</p>
  
  <p>the req.body is like this <code>{ username: 'aa', password: 'ss' }</code></p>
  
  <p>i am using a function to post and after posting a want to work with the response.</p>
  
  <p>Using res.sendStatus(200) or res.sendStatus(401) i can access it like this</p>
  
  <pre><code>post('/login', { username, password })
      .then(({ status }) =&gt; {
        if (status === 200) {alert('login success'); window.location.href = "/about"}
        else alert('login failed')
      })
  </code></pre>
  
  <p>how can i access the username  using <code>then()</code> when responding with <code>res.send(req.body)</code> or <code>res.json(req.body)</code></p>
  
  <p>i tried <code>.then(({ username }) =&gt; {alert(username)})</code> and get undefined error</p>