summaryrefslogtreecommitdiffstats
path: root/api/middleware/cors.go
blob: 1fbd85094f0fbb310e2dbbac6e40f9e846fbb452 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package middleware

import "net/http"

func PermissiveCors() func(http.HandlerFunc) http.HandlerFunc {
	return func(next http.HandlerFunc) http.HandlerFunc {
		return func(w http.ResponseWriter, r *http.Request) {
			w.Header().Set("Access-Control-Allow-Origin", "*")
			w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")

			next(w, r)
		}
	}
}