'Golang: Uncaught (in promise) TypeError: Failed to fetch

I've added cors on main.go

however, when I do fetch =>

fetch("http://e047d13752fa.ngrok.io/api/v1/campaigns/15").then(res => res.json()).then(data => console.log(data))

an error like this appears:

GET http://e047d13752fa.ngrok.io/api/v1/campaigns/15 net::ERR_FAILED

Uncaught (in promise) TypeError: Failed to fetch

do you have a solution to solve the error like above?

Thank you :pray: I'm still new to the Golang language.

go


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source