From 0adf6d25f34eb949571e24ecb9064481d5ee7d4b Mon Sep 17 00:00:00 2001 From: Asara Date: Mon, 27 May 2019 21:17:09 -0400 Subject: [PATCH] Fix path to repo, add cors for testing --- main.go | 15 +++++++++++---- packages/auth/auth.go | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 9526d69..30c6468 100644 --- a/main.go +++ b/main.go @@ -7,12 +7,13 @@ import ( "net/http" "os" - "git.minhas.io/asara/sudoscientist/packages/auth" - "git.minhas.io/asara/sudoscientist/packages/blog" - "git.minhas.io/asara/sudoscientist/packages/database" - "git.minhas.io/asara/sudoscientist/packages/users" + "git.minhas.io/asara/sudoscientist-go-backend/packages/auth" + "git.minhas.io/asara/sudoscientist-go-backend/packages/blog" + "git.minhas.io/asara/sudoscientist-go-backend/packages/database" + "git.minhas.io/asara/sudoscientist-go-backend/packages/users" "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" + "github.com/go-chi/cors" "github.com/go-chi/jwtauth" "github.com/go-chi/render" ) @@ -51,7 +52,13 @@ func main() { func Routes() *chi.Mux { router := chi.NewRouter() + // enable cors testing + cors := cors.New(cors.Options{ + AllowedOrigins: []string{"*"}, + }) + router.Use( + cors.Handler, render.SetContentType(render.ContentTypeJSON), middleware.Logger, middleware.DefaultCompress, diff --git a/packages/auth/auth.go b/packages/auth/auth.go index 333b7be..5e29eb3 100644 --- a/packages/auth/auth.go +++ b/packages/auth/auth.go @@ -4,7 +4,7 @@ import ( "database/sql" "encoding/json" "fmt" - "git.minhas.io/asara/sudoscientist/packages/users" + "git.minhas.io/asara/sudoscientist-go-backend/packages/users" "github.com/badoux/checkmail" "github.com/dgrijalva/jwt-go" "github.com/go-chi/chi"