使用net / http可配置的处理程序来处理CORS请求-Golang开发

时间:2021-05-26 14:41:05
【文件属性】:
文件名称:使用net / http可配置的处理程序来处理CORS请求-Golang开发
文件大小:22KB
文件格式:ZIP
更新时间:2021-05-26 14:41:05
Golang Web Frameworks Go CORS处理程序CORS是一个net / http处理程序,在Golang中实现了跨源资源共享W3规范。 入门安装Go并设置GOPATH之后,创建您的第一个.go文件。 我们将使用Go CORS处理程序CORS是一个net / http处理程序,在Golang中实现Cross Origin Resource Sharing W3规范。 入门安装Go并设置GOPATH之后,创建您的第一个.go文件。 我们将其称为server.go。 包main import(“ net / http”“ github.com/rs/cors”)func main(){mux:= http.NewServeMux()mux.HandleFunc(“ /”,func(w http.ResponseWriter,r * http .Request){w.Header()。Set(“ Content-Type”,“ application / json”)w.Write([] by
【文件预览】:
cors-master
----.travis.yml(72B)
----wrapper()
--------gin()
----utils_test.go(2KB)
----bench_test.go(2KB)
----.github()
--------workflows()
----LICENSE(1KB)
----cors_test.go(14KB)
----examples()
--------gorilla()
--------gin()
--------goji()
--------httprouter()
--------buffalo()
--------negroni()
--------martini()
--------nethttp()
--------openbar()
--------alice()
--------chi()
--------default()
----cors.go(14KB)
----README.md(7KB)
----utils.go(1KB)
----go.mod(81B)

网友评论