0

I'm sending a message to routes.js, but when I send the post, it doesn't log anything, I tried to log string but it doesn't work either.

const datatosee = {
  getaxios: true
}
            
axios.post('http://localhost:4000/app/web', datatosee)
  .then(response => console.log(response.data))
  .catch(e => console.error(e))

Thanks for your attention, I appreciate the help.

Phil
  • 157,677
  • 23
  • 242
  • 245
  • add a `.catch(e => console.error(e))` – Michael Mano Jul 23 '21 at 01:22
  • Nothing happens, remains the same. – DeathAbyss Jul 23 '21 at 01:26
  • If there is no response in both `then` and `catch` blocks, then maybe the promise is not resolved (rejected) yet. You can do a quick look at the `Network` tab in your browser developer tool to see if the request is pending. Maybe your server does not handle the request correctly. If I'm correct, after the request timeout, you can catch the timeout error. – Tuan LE CONG Jul 23 '21 at 02:17
  • You're right, apparently it gives this error "`Unchecked runtime.lastError: The message port closed before a response was received.`", although I don't understand why, since the post works and without errors. – DeathAbyss Jul 23 '21 at 02:24
  • Could be an issue with extensions. Check this link: https://stackoverflow.com/questions/54126343/how-to-fix-unchecked-runtime-lasterror-the-message-port-closed-before-a-respon – Ashik Jul 23 '21 at 02:26

0 Answers0