Skip to content

go-http-utils/cors

Repository files navigation

cors

Build Status Coverage Status

CORS middleware for Go.

Installation

go get -u github.com/go-http-utils/cors

Documentation

API documentation can be found here: https://godoc.org/github.com/go-http-utils/cors

Usage

import (
  "github.com/go-http-utils/cors"
)
mux := http.NewServeMux()
mux.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) {
  res.Write([]byte("Hello World"))
})

http.ListenAndServe(":8080", cors.Handler(mux))