Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I can't send request to api

I have Nuxt JS project. I can’t make a request to the Node js project I run on localhost. It gives Cors error in Network section. I can send requests with Postman, but not from the project. I added the below but my problem is not solved.

  axios: {
    baseURL: 'http://localhost:3001', // Used as fallback if no runtime config is provided
    proxyHeaders: false,
    credentials: false
  },

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I need you to provide me with more details so that I can identify the problem, but in general this problem can be solved by the server side by add
your site host in header Access-Control-Allow-Origin' = '*' you can replace * with you host like if you serve front-end in localhost:3000 you can make it like Access-Control-Allow-Origin' = 'http://localhost:3000'

Examples Uses

app.use(cors({
  origin: 'http://yourapp.com'
}));
app.enableCors({
  origin: '*'
});
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading