Axios - Server Error Error: Request failed with status code 404

Asked

Viewed 10 times

0

I’m having a problem, I’m doing an authentication but this giving Error: Request failed with status code 404, and I don’t know what’s wrong with the url.

import axios from "axios";
import { parseCookies } from "nookies";

export function getAPIClient(ctx?: any) {
  const { 'novo-app.token': token } = parseCookies(ctx)

  const api = axios.create({
    baseURL: 'http://localhost:3000',      
  })

  api.interceptors.request.use(config => {
    console.log(config);    
    return config;
  })

  if (token) {
    api.defaults.headers['Authorization'] = `Bearer ${token}`;
  }

  return api;
}
  • Could you post the route of the server that authenticates? This would be the route of the server that is running at the address: http://localhost:3000

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.