Fix path to repo, add cors for testing

This commit is contained in:
Amarpreet Minhas 2019-05-27 21:17:09 -04:00
parent 0fc950352c
commit 0adf6d25f3
2 changed files with 12 additions and 5 deletions

15
main.go
View file

@ -7,12 +7,13 @@ import (
"net/http" "net/http"
"os" "os"
"git.minhas.io/asara/sudoscientist/packages/auth" "git.minhas.io/asara/sudoscientist-go-backend/packages/auth"
"git.minhas.io/asara/sudoscientist/packages/blog" "git.minhas.io/asara/sudoscientist-go-backend/packages/blog"
"git.minhas.io/asara/sudoscientist/packages/database" "git.minhas.io/asara/sudoscientist-go-backend/packages/database"
"git.minhas.io/asara/sudoscientist/packages/users" "git.minhas.io/asara/sudoscientist-go-backend/packages/users"
"github.com/go-chi/chi" "github.com/go-chi/chi"
"github.com/go-chi/chi/middleware" "github.com/go-chi/chi/middleware"
"github.com/go-chi/cors"
"github.com/go-chi/jwtauth" "github.com/go-chi/jwtauth"
"github.com/go-chi/render" "github.com/go-chi/render"
) )
@ -51,7 +52,13 @@ func main() {
func Routes() *chi.Mux { func Routes() *chi.Mux {
router := chi.NewRouter() router := chi.NewRouter()
// enable cors testing
cors := cors.New(cors.Options{
AllowedOrigins: []string{"*"},
})
router.Use( router.Use(
cors.Handler,
render.SetContentType(render.ContentTypeJSON), render.SetContentType(render.ContentTypeJSON),
middleware.Logger, middleware.Logger,
middleware.DefaultCompress, middleware.DefaultCompress,

View file

@ -4,7 +4,7 @@ import (
"database/sql" "database/sql"
"encoding/json" "encoding/json"
"fmt" "fmt"
"git.minhas.io/asara/sudoscientist/packages/users" "git.minhas.io/asara/sudoscientist-go-backend/packages/users"
"github.com/badoux/checkmail" "github.com/badoux/checkmail"
"github.com/dgrijalva/jwt-go" "github.com/dgrijalva/jwt-go"
"github.com/go-chi/chi" "github.com/go-chi/chi"