axios return 404 error while it works on postman

Viewed 1122

My code:

var axios = require("axios");
export default async function({ req, state, redirect }) {
   var token = getCookie("realtime_jwt_token", req);
   const response = await axios.post("http://localhost:3000/api/checkToken", {
      token
   });
   console.log(response);
}

When i call my middleware like this whenever i try to access some specific page, i get an 404 error.

Request failed with status code 404

I have tried the request on Postman and there it works fine. The mode is set to universal Where is the mistake here?

0 Answers
Related