From 73e8d3c14e9ce219977e911049083b73b048e727 Mon Sep 17 00:00:00 2001 From: Preetinder Singh Date: Sat, 15 Jun 2024 18:48:24 +0530 Subject: [PATCH 1/3] Solved go version workflow error --- .github/workflows/check-pull-requests.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-pull-requests.yml b/.github/workflows/check-pull-requests.yml index 182d216..58ad1a3 100644 --- a/.github/workflows/check-pull-requests.yml +++ b/.github/workflows/check-pull-requests.yml @@ -30,10 +30,11 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.20 + go-version: 1.20.4 - name: Install dependencies - run: cd backend && go mod tidy + run: go mod tidy + working-directory: ./backend - name: Wait for Redis to be ready run: | @@ -45,7 +46,9 @@ jobs: # - name: Run tests # env: # REDIS_URL: redis://localhost:6379 - # run: cd backend && go test ./... + # run: go test ./... + # working-directory: ./backend - name: Build the project - run: cd backend && go build -v -o main main.go + run: go build -v -o main main.go + working-directory: ./backend From 5a3d7b296de49dbedaf993bc44ec95a9dea0ec67 Mon Sep 17 00:00:00 2001 From: Preetinder Singh Date: Sat, 15 Jun 2024 18:55:28 +0530 Subject: [PATCH 2/3] Solved router error --- backend/pkg/router/router.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/pkg/router/router.go b/backend/pkg/router/router.go index 7161ffe..d64ac75 100644 --- a/backend/pkg/router/router.go +++ b/backend/pkg/router/router.go @@ -35,10 +35,10 @@ func GetAllLinks(w http.ResponseWriter, r *http.Request) { w.Write([]byte("No links found")) return } - err := json.NewEncoder(w).Encode(links) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return + var linksData []string + for _, link := range links { + // w.Write([]byte(fmt.Sprintf("%s - %s\n", link.ShortURL, link.Link))) + linksData = append(linksData, fmt.Sprintf("%s - %s\n", link.ShortURL, link.Link)) } page.Execute(w, linksData) } From 93cf15014f26adb8db31f618338ec9d73043d591 Mon Sep 17 00:00:00 2001 From: Preetinder Singh Date: Tue, 18 Jun 2024 14:34:24 +0530 Subject: [PATCH 3/3] Jwt token and register added in auth --- backend/go-templates/view.html | 2 +- backend/go.mod | 1 + backend/go.sum | 2 + backend/main.go | 6 +- backend/pkg/auth/auth.go | 105 +++++++++++++++++++ frontend/src/Maincontent.jsx | 2 +- frontend/yarn.lock | 183 +++++---------------------------- 7 files changed, 139 insertions(+), 162 deletions(-) create mode 100644 backend/pkg/auth/auth.go diff --git a/backend/go-templates/view.html b/backend/go-templates/view.html index db38aac..e4f1492 100644 --- a/backend/go-templates/view.html +++ b/backend/go-templates/view.html @@ -42,7 +42,7 @@

All Links