Skip to content

Commit 777e548

Browse files
committed
feat: fix organization code and impleament commentary
1 parent db07a46 commit 777e548

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

cmd/main.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ import (
66
"api-go/middleware"
77
"api-go/repository"
88
"api-go/usecase"
9-
109
"github.com/gin-gonic/gin"
1110
)
1211

1312
func main() {
14-
1513
server := gin.Default()
1614

1715
dbConnection, err := db.ConnectDb()
16+
1817
if err != nil {
1918
panic(err)
19+
return err
2020
}
2121

2222
ProductRepository := repository.NewProductRepository(dbConnection)
@@ -25,12 +25,17 @@ func main() {
2525

2626
ProductController := controller.NewProductController(*ProductUseCase)
2727

28-
server.GET("/ping", func(ctx *gin.Context) {
28+
server.GET("/ping-dev", func(ctx *gin.Context) {
2929
ctx.JSON(200, gin.H{
30-
"message": "primeiros testes",
30+
"message": "Servidor Está ativo!",
3131
})
3232
})
3333

34+
/*
35+
routes server
36+
products
37+
*/
38+
3439
protected := server.Group("/")
3540
protected.Use(middleware.AuthMiddleware())
3641
{

model/product.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package model
22

3+
/*
4+
Product Struct
5+
*/
6+
37
type Product struct {
48
ID int `json:"id"`
59
Name string `json:"name"`
610
Price float64 `json:"price"`
7-
}
11+
}

0 commit comments

Comments
 (0)