Skip to content

Commit 21650d7

Browse files
committed
feat : home routes
1 parent b43dc98 commit 21650d7

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require (
66
github.com/bytedance/sonic v1.10.2 // indirect
77
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
88
github.com/chenzhuoyu/iasm v0.9.1 // indirect
9+
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
910
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
1011
github.com/gin-contrib/sse v0.1.0 // indirect
1112
github.com/gin-gonic/gin v1.9.1 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ github.com/chenzhuoyu/iasm v0.9.1 h1:tUHQJXo3NhBqw6s33wkGn9SP3bvrWLdlVIJ3hQBL7P0
1111
github.com/chenzhuoyu/iasm v0.9.1/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
1212
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1313
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
14+
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
15+
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
1416
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
1517
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
1618
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package main
22

33
import (
44
"gin-mongo-api/src/database"
5-
"github.com/gin-gonic/gin"
65
"gin-mongo-api/src/routes"
6+
"github.com/gin-gonic/gin"
77
)
88

99
func main() {

src/controllers/authControllers.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ func Register() gin.HandlerFunc {
7272
}
7373
}
7474

75+
func Greeting() gin.HandlerFunc {
76+
return func(c *gin.Context) {
77+
c.JSON(http.StatusCreated, res.UserResponse{Status: http.StatusAccepted, Data: map[string]interface{}{"success": true}})
78+
}
79+
}
80+
7581
func Login() gin.HandlerFunc {
7682
return func(c *gin.Context) {
7783
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)

src/routes/userRoutes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import ("github.com/gin-gonic/gin"
44
"gin-mongo-api/src/controllers")
55

66
func UserRoute(router *gin.Engine) {
7+
router.GET("/",controllers.Greeting())
78
router.POST("/register", controllers.Register());
89
router.POST("/login",controllers.Login())
910
};

0 commit comments

Comments
 (0)