Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions internal/sbi/api_lab6.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package sbi

import (
"net/http"

Check failure on line 4 in internal/sbi/api_lab6.go

View workflow job for this annotation

GitHub Actions / lint (1.21)

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/free5gc) --custom-order (gci)

"github.com/gin-gonic/gin"

Check failure on line 6 in internal/sbi/api_lab6.go

View workflow job for this annotation

GitHub Actions / lint (1.21)

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/free5gc) --custom-order (gci)
)

// Rutas del nuevo servicio /lab6
func (s *Server) getLab6Route() []Route {
return []Route{

Check failure on line 11 in internal/sbi/api_lab6.go

View workflow job for this annotation

GitHub Actions / lint (1.21)

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/free5gc) --custom-order (gci)
{
Name: "Lab6 Info",
Method: http.MethodGet,
Pattern: "/", // -> /lab6/
APIFunc: func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "Lab 6 OK",
"author": "ValentinoV",
})
},
},
{
Name: "Lab6 Echo",
Method: http.MethodPost,
Pattern: "/echo", // -> /lab6/echo
APIFunc: func(c *gin.Context) {
var body map[string]interface{}

if err := c.BindJSON(&body); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"error": "invalid JSON body",
})
return
}

c.JSON(http.StatusOK, gin.H{
"message": "Lab 6 echo",
"received": body,
})
},
},
}
}
3 changes: 3 additions & 0 deletions internal/sbi/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ func newRouter(s *Server) *gin.Engine {
spyFamilyGroup := router.Group("/spyfamily")
applyRoutes(spyFamilyGroup, s.getSpyFamilyRoute())

lab6Group := router.Group("/lab6")
applyRoutes(lab6Group, s.getLab6Route())

return router
}

Expand Down
Loading