Home > Back-end >  How to use timeapi.io API with JS?
How to use timeapi.io API with JS?

Time:05-16

I'm using another api without problems, like this:

fetch("https://www.boredapi.com/api/activity").then(r => r.text()).then(console.log);

But this doesn't work:

fetch("https://www.timeapi.io/api/Time/current/zone?timeZone=Brazil/East").then(r => r.text()).then(console.log);

With the code above I'm getting a blank response :(

CodePudding user response:

This returns cors error.

You can use backend to download data or use proxy

  • Related