2021
05-29
05-29
go 原生http web 服务跨域restful api的写法介绍
错误写法funcmain(){openHttpListen()}funcopenHttpListen(){http.HandleFunc("/",receiveClientRequest)fmt.Println("goserverstartrunning...")err:=http.ListenAndServe(":9090",nil)iferr!=nil{log.Fatal("ListenAndServe:",err)}}funcreceiveClientRequest(whttp.ResponseWriter,r*http.Request){w.Header().Set("Access-Control-Allow-Origin","*")...
继续阅读 >