Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70435

Axios Error Api local

$
0
0

@Cephaz wrote:

Hello,

In my file a have this code

const data = () => {
axios.get(‘https://localhost:3000/api/events’,{
headers: {
‘Access-Control-Allow-Origin’: ‘*’,
}
})
.then(res => {
console.log(res.data);
})
.catch(function (error) {
console.log(error);
})
}
The code not working for my local api and I don’t know how to fix it.

This is the console display
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:3000/api/events. (Reason: CORS request did not succeed)

Please i need help

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>