From 094c252a428c5576cddd65afcb56895a1433a679 Mon Sep 17 00:00:00 2001 From: ziddah edem Date: Tue, 28 Jun 2022 11:23:34 +0000 Subject: [PATCH 1/5] updated --- cmd/server/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/server/main.go b/cmd/server/main.go index 073609b..f36545d 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -59,5 +59,10 @@ func main() { }) AuthRoutes.AuthRoute(router) + + server.NoRoute(func(ctx *gin.Context) { + ctx.JSON(http.StatusNotFound, gin.H{"status": "fail", "message": fmt.Sprintf("Route %s not found", ctx.Request.URL)}) + }) + log.Fatal(server.Run(":" + config.Port)) } From 6d2eb2507e20f1c65b99565205d2fd7c031f8167 Mon Sep 17 00:00:00 2001 From: Edem Date: Wed, 14 Sep 2022 15:15:56 +0000 Subject: [PATCH 2/5] updated --- cmd/server/main.go | 8 ++++---- controllers/signup.controller.go | 4 ++-- go.mod | 2 +- routes/auth.route.go | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/server/main.go b/cmd/server/main.go index f36545d..cc484c2 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -7,10 +7,10 @@ import ( "net/http" "github.com/gin-gonic/gin" - "github.com/wpcodevo/golang-postgresql-grpc/config" - "github.com/wpcodevo/golang-postgresql-grpc/controllers" - dbConn "github.com/wpcodevo/golang-postgresql-grpc/db/sqlc" - "github.com/wpcodevo/golang-postgresql-grpc/routes" + "github.com/wpcodevo/golang-postgresql-api/config" + "github.com/wpcodevo/golang-postgresql-api/controllers" + dbConn "github.com/wpcodevo/golang-postgresql-api/db/sqlc" + "github.com/wpcodevo/golang-postgresql-api/routes" _ "github.com/lib/pq" ) diff --git a/controllers/signup.controller.go b/controllers/signup.controller.go index 29d77db..9341cf7 100644 --- a/controllers/signup.controller.go +++ b/controllers/signup.controller.go @@ -5,8 +5,8 @@ import ( "time" "github.com/gin-gonic/gin" - db "github.com/wpcodevo/golang-postgresql-grpc/db/sqlc" - "github.com/wpcodevo/golang-postgresql-grpc/utils" + db "github.com/wpcodevo/golang-postgresql-api/db/sqlc" + "github.com/wpcodevo/golang-postgresql-api/utils" ) type AuthController struct { diff --git a/go.mod b/go.mod index 1b08770..6bf0d49 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/wpcodevo/golang-postgresql-grpc +module github.com/wpcodevo/golang-postgresql-api go 1.18 diff --git a/routes/auth.route.go b/routes/auth.route.go index a33e178..7643bbf 100644 --- a/routes/auth.route.go +++ b/routes/auth.route.go @@ -2,7 +2,7 @@ package routes import ( "github.com/gin-gonic/gin" - "github.com/wpcodevo/golang-postgresql-grpc/controllers" + "github.com/wpcodevo/golang-postgresql-api/controllers" ) type AuthRoutes struct { From d883d935375be4fa921696ca4ed6737f8ef01950 Mon Sep 17 00:00:00 2001 From: wpcodevo Date: Thu, 22 Sep 2022 19:47:22 +0000 Subject: [PATCH 3/5] updated --- readMe.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/readMe.md b/readMe.md index 8b89b15..4d37222 100644 --- a/readMe.md +++ b/readMe.md @@ -1,4 +1,10 @@ # API with Golang, PostgreSQL, SQLC, Docker & Gin Gonic ### 1. API with Golang, PostgreSQL, SQLC & Gin Gonic: Project Setup -[API with Golang, PostgreSQL, SQLC & Gin Gonic: Project Setup](https://codevoweb.com/api-golang-postgresql-sqlc-gin-gonic-project-setup) \ No newline at end of file +[API with Golang, PostgreSQL, SQLC & Gin Gonic: Project Setup](https://codevoweb.com/api-golang-postgresql-sqlc-gin-gonic-project-setup) + +### 2. Build Golang & PostgreSQL API: JWT Access and Refresh Tokens +[Build Golang & PostgreSQL API: JWT Access and Refresh Tokens](https://codevoweb.com/golang-postgresql-api-access-and-refresh-tokens) + +### 3. Golang CRUD RESTful API with SQLC and PostgreSQL +[Golang CRUD RESTful API with SQLC and PostgreSQL](https://codevoweb.com/golang-crud-restful-api-with-sqlc-and-postgresql) \ No newline at end of file From a04cfaa57139715f289dcf24df8a7d2fface0da1 Mon Sep 17 00:00:00 2001 From: CODEVO Date: Sun, 2 Oct 2022 09:19:42 +0000 Subject: [PATCH 4/5] Update readMe.md --- readMe.md | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/readMe.md b/readMe.md index 4d37222..7f535ea 100644 --- a/readMe.md +++ b/readMe.md @@ -1,10 +1,31 @@ -# API with Golang, PostgreSQL, SQLC, Docker & Gin Gonic +# How to Setup SQLC CRUD API with Golang and Gin Gonic -### 1. API with Golang, PostgreSQL, SQLC & Gin Gonic: Project Setup -[API with Golang, PostgreSQL, SQLC & Gin Gonic: Project Setup](https://codevoweb.com/api-golang-postgresql-sqlc-gin-gonic-project-setup) +![How to Setup SQLC CRUD API with Golang and Gin Gonic](https://codevoweb.com/wp-content/uploads/2022/06/How-to-Setup-SQLC-CRUD-API-with-Golang-and-Gin-Gonic.webp) + +This article will teach you how to set up a SQLC API project with Golang, standard Database/SQL package, Gin Gonic, PostgreSQL, Golang-migrate, and Docker-compose. You will also learn how to generate Golang database CRUD functions and Structs with the SQLC compiler. The SQLC Golang API will use a PostgreSQL database and run on the Gin Gonic HTTP server. We will use the Golang-migrate package to push the SQL schema to the database. + +## Topics Covered + +- How to Setup Golang with PostgreSQL +- How to Run Database Migration in Golang +- Generate Golang CRUD Functions and Structs with SQLC +- Initialize the Golang Project +- Connect the Golang App to PostgreSQL +- How to Hash Passwords in Golang +- Create a Route Handler to Register User +- Setup Routing +- Configure the Main Server File +- Testing the Golang Gin API + +Read the entire article here: [https://codevoweb.com/api-golang-postgresql-sqlc-gin-gonic-project-setup](https://codevoweb.com/api-golang-postgresql-sqlc-gin-gonic-project-setup) + +Articles in this series: + +### 1. How to Setup SQLC CRUD API with Golang and Gin Gonic +[How to Setup SQLC CRUD API with Golang and Gin Gonic](https://codevoweb.com/api-golang-postgresql-sqlc-gin-gonic-project-setup) ### 2. Build Golang & PostgreSQL API: JWT Access and Refresh Tokens [Build Golang & PostgreSQL API: JWT Access and Refresh Tokens](https://codevoweb.com/golang-postgresql-api-access-and-refresh-tokens) ### 3. Golang CRUD RESTful API with SQLC and PostgreSQL -[Golang CRUD RESTful API with SQLC and PostgreSQL](https://codevoweb.com/golang-crud-restful-api-with-sqlc-and-postgresql) \ No newline at end of file +[Golang CRUD RESTful API with SQLC and PostgreSQL](https://codevoweb.com/golang-crud-restful-api-with-sqlc-and-postgresql) From 74f62460503a4951994294cb2231cdb531624aff Mon Sep 17 00:00:00 2001 From: CODEVO Date: Sun, 2 Oct 2022 15:34:31 +0000 Subject: [PATCH 5/5] Update readMe.md --- readMe.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readMe.md b/readMe.md index 7f535ea..1ee7e3b 100644 --- a/readMe.md +++ b/readMe.md @@ -1,9 +1,9 @@ # How to Setup SQLC CRUD API with Golang and Gin Gonic -![How to Setup SQLC CRUD API with Golang and Gin Gonic](https://codevoweb.com/wp-content/uploads/2022/06/How-to-Setup-SQLC-CRUD-API-with-Golang-and-Gin-Gonic.webp) - This article will teach you how to set up a SQLC API project with Golang, standard Database/SQL package, Gin Gonic, PostgreSQL, Golang-migrate, and Docker-compose. You will also learn how to generate Golang database CRUD functions and Structs with the SQLC compiler. The SQLC Golang API will use a PostgreSQL database and run on the Gin Gonic HTTP server. We will use the Golang-migrate package to push the SQL schema to the database. +![How to Setup SQLC CRUD API with Golang and Gin Gonic](https://codevoweb.com/wp-content/uploads/2022/06/How-to-Setup-SQLC-CRUD-API-with-Golang-and-Gin-Gonic.webp) + ## Topics Covered - How to Setup Golang with PostgreSQL