Added CORS middleware

This commit is contained in:
Deluan
2020-01-09 13:51:54 -05:00
committed by Deluan Quintão
parent ff5b91da54
commit 85f7fdd285
4 changed files with 6 additions and 1 deletions
+2
View File
@@ -12,6 +12,7 @@ import (
"github.com/cloudsonic/sonic-server/scanner"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
"github.com/go-chi/cors"
)
type App struct {
@@ -40,6 +41,7 @@ func (a *App) Run(addr string) {
func (a *App) initRoutes() {
r := chi.NewRouter()
r.Use(cors.Default().Handler)
r.Use(middleware.RequestID)
r.Use(middleware.RealIP)
r.Use(middleware.Recoverer)