diff --git a/src/api/routes/router.go b/src/api/routes/router.go index 6d1e8fb..625a03b 100644 --- a/src/api/routes/router.go +++ b/src/api/routes/router.go @@ -7,9 +7,9 @@ import ( "net/http" "time" - auth0 "github.com/auth0-community/go-auth0" + "github.com/auth0-community/go-auth0" "github.com/julienschmidt/httprouter" - jose "gopkg.in/square/go-jose.v2" + "gopkg.in/square/go-jose.v2" ) // AuthConfig contains the Auth0 configuration passed from the "auth" JSON object. @@ -45,7 +45,7 @@ func withAuth(next DBHandler, cfg *AuthConfig) DBHandler { audience := []string{fmt.Sprintf("https://%s/userinfo", cfg.Domain)} configuration := auth0.NewConfiguration(secretProvider, audience, fmt.Sprintf("https://%s/", cfg.Domain), jose.HS256) - validator := auth0.NewValidator(configuration) + validator := auth0.NewValidator(configuration, nil) token, err := validator.ValidateRequest(r) @@ -77,5 +77,6 @@ func NewRouter(db *sql.DB, cfg *AuthConfig) *httprouter.Router { router.Handle(route.Method, route.Pattern, withDB(withAuth(route.Func, cfg), db)) } } + // router.ServeFiles("/*filepath", http.Dir("/public")) return router } diff --git a/src/api/routes/routes.go b/src/api/routes/routes.go index 6d9add8..57e8add 100644 --- a/src/api/routes/routes.go +++ b/src/api/routes/routes.go @@ -18,7 +18,7 @@ var routes = Routes{ Route{ "Journal", "GET", - "/journal", + "/api/journal", journal, false, }, diff --git a/src/app/package.json b/src/app/package.json index a5e4424..f90bacd 100644 --- a/src/app/package.json +++ b/src/app/package.json @@ -13,7 +13,7 @@ "test": "npm run unit && npm run e2e", "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs", "apistart": "cd .. && go build -o mpj-api.exe && mpj-api.exe", - "vue": "node build/build.js prod && go build -o mpj-api.exe && mpj-api.exe" + "vue": "node build/build.js prod && cd .. && go build -o mpj-api.exe && mpj-api.exe" }, "dependencies": { "auth0-js": "^9.3.3",