Skip to content

Commit

Permalink
ft(routes): handler routes assigned
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhantprateek committed Aug 20, 2023
1 parent c0a4889 commit 389ae2b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
4 changes: 2 additions & 2 deletions authentication/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func Init(ctx *fiber.Ctx) error {
}

// @Desp: Create User
// @Route:
// @Route: /auth/user
// @Method: POST
func CreateUser(ctx *fiber.Ctx) error {
user := new(models.User)
Expand All @@ -39,7 +39,7 @@ func CreateUser(ctx *fiber.Ctx) error {
}

// @Desp: Get User by Id
// @Route: /auth/user
// @Route: /auth/user/:id
// @Method: GET
func RetrieveUser(ctx *fiber.Ctx) error {
user := models.User{}
Expand Down
13 changes: 11 additions & 2 deletions authentication/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
package authentication
package main

import (
auth_api "landate/authentication/routes"
"log"
)

// This Service contain User Authentication information
// and Its Profile Information
func AuthSVC() {
func main() {

if err := auth_api.Init(); err != nil {
log.Fatalln("Unable to start auth service.")
}

}
29 changes: 29 additions & 0 deletions authentication/routes/routes.go
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
package routes

import (
handler "landate/authentication/handlers"
"landate/config"

"github.com/gofiber/fiber/v2"
)

func AuthRoutes(router *fiber.App) {
router.Get("/", handler.Init)
router.Post("/auth/user", handler.CreateUser)
router.Get("/auth/user/:id", handler.RetrieveUser)
router.Delete("/auth/user/:id", handler.RemoveUser)
router.Get("/auth/users", handler.GetAllUsers)
router.Patch("/auth/user/:id", handler.UpdateUser)
router.Get("/auth/user/:walletAddress", handler.GetUserByWalledId)

}

func Init() error {

app := fiber.New()

AuthRoutes(app)

AUTH_PORT := config.GetEnvConfig("AUTH_SERVICE_PORT")
err := app.Listen(":" + AUTH_PORT)
return err
}

0 comments on commit 389ae2b

Please sign in to comment.