草庐IT

javascript - 在 kami 制作的 golang 服务器中使用 CORS

您好,我正在尝试从在localhost:3000上运行的ReactJSWeb应用程序访问在localhost:8000上运行的Golangapi上的GET请求。但是每当我尝试这样做时,我都会收到以下错误:FetchAPIcannotloadhttp://localhost:8000/api/v1/systems.No'Access-Control-Allow-Origin'headerispresentontherequestedresource.Origin'http://localhost:3000'isthereforenotallowedaccess.Theresponseha

javascript - 在 kami 制作的 golang 服务器中使用 CORS

您好,我正在尝试从在localhost:3000上运行的ReactJSWeb应用程序访问在localhost:8000上运行的Golangapi上的GET请求。但是每当我尝试这样做时,我都会收到以下错误:FetchAPIcannotloadhttp://localhost:8000/api/v1/systems.No'Access-Control-Allow-Origin'headerispresentontherequestedresource.Origin'http://localhost:3000'isthereforenotallowedaccess.Theresponseha