title: Handling errors from Express API with Vue
body: <p>I'm having some difficulty accessing the JSON object returned with a 400 error. </p>
  
  <p>The response from my Vue app is only error 400, without the JSON data. </p>
  
  <pre><code>Error: Request failed with status code 400
      at createError (createError.js?16d0:16)
      at settle (settle.js?db52:18)
      at XMLHttpRequest.handleLoad (xhr.js?ec6c:77)
  </code></pre>
  
  <p>The response from the same using Postman returns both the error code and the message. </p>
  
  <p>How do I access the JSON response in my Vue app?</p>
  
  <pre><code>{
      "error": "Email already exists!"
  }
  </code></pre>
  
  <p>Express API code:</p>
  
  <p><code>res.status(400).json({ error: 'Email already exists!' });</code></p>
  
  <p>My Vue code: </p>
  
  <pre><code>handleSubmit () {
    this.$http.post('http://localhost:3000/users/create', this.user)
        .then(response =&gt; {
            const status = JSON.parse(response.status)
            if (status === 200) router.push('/users')
        })
        // why doesn't the json response show
        .catch(err =&gt; {
            console.log(err)
        })
  }
  </code></pre>