| 31 | } |
| 32 | |
| 33 | func corsMiddleware(allowedOrigins []string) mux.MiddlewareFunc { |
| 34 | return cors.New(cors.Options{ |
| 35 | AllowedOrigins: allowedOrigins, |
| 36 | AllowedMethods: []string{ |
| 37 | http.MethodHead, |
| 38 | http.MethodGet, |
| 39 | http.MethodPost, |
| 40 | http.MethodPut, |
| 41 | http.MethodPatch, |
| 42 | http.MethodDelete, |
| 43 | }, |
| 44 | AllowedHeaders: []string{"Authorization", "Accept", "Content-Type", "X-Requested-With"}, |
| 45 | AllowCredentials: true, |
| 46 | }).Handler |
| 47 | } |
| 48 | |
| 49 | func accessLogMiddleware(logger *zap.Logger) mux.MiddlewareFunc { |
| 50 | logger = logger.Named("http.access") |