diff --git a/go1.24.3.linux-amd64.tar.gz b/go1.24.3.linux-amd64.tar.gz new file mode 100644 index 0000000..0b1bb1e Binary files /dev/null and b/go1.24.3.linux-amd64.tar.gz differ diff --git a/internal/sbi/api_spyfamily.go b/internal/sbi/api_spyfamily.go index c5d477e..e308b1e 100644 --- a/internal/sbi/api_spyfamily.go +++ b/internal/sbi/api_spyfamily.go @@ -42,3 +42,33 @@ func (s *Server) HTTPSerchSpyFamilyCharacter(c *gin.Context) { s.Processor().FindSpyFamilyCharacterName(c, targetName) } +func HTTPGetStudent(c *gin.Context) { + name := c.Param("name") + + c.JSON(200, gin.H{ + "student": name, + "status": "active", + }) +} + +func HTTPCreateStudent(c *gin.Context) { + + type Student struct { + Name string `json:"name"` + Age int `json:"age"` + } + + var body Student + + if err := c.ShouldBindJSON(&body); err != nil { + c.JSON(400, gin.H{ + "error": err.Error(), + }) + return + } + + c.JSON(201, gin.H{ + "message": "Student created successfully", + "student": body, + }) +} diff --git a/internal/sbi/router.go b/internal/sbi/router.go index b62139f..bb8b6a1 100644 --- a/internal/sbi/router.go +++ b/internal/sbi/router.go @@ -43,6 +43,11 @@ func newRouter(s *Server) *gin.Engine { applyRoutes(defaultGroup, s.getDefaultRoute()) spyFamilyGroup := router.Group("/spyfamily") +studentGroup := router.Group("/student") +{ + studentGroup.GET("/:name", HTTPGetStudent) + studentGroup.POST("/", HTTPCreateStudent) +} applyRoutes(spyFamilyGroup, s.getSpyFamilyRoute()) return router