Mounting handlers and basic swagger docs example

This commit is contained in:
Imbus 2024-03-08 10:16:56 +01:00
parent f75cb7e9fc
commit 13c12b424a
2 changed files with 28 additions and 0 deletions

View file

@ -46,6 +46,17 @@ type GState struct {
ButtonCount int
}
// Register is a simple handler that registers a new user
//
// @Summary Register a new user
// @Description Register a new user
// @Tags User
// @Accept json
// @Produce json
// @Success 200 {string} string "User added"
// @Failure 400 {string} string "Bad request"
// @Failure 500 {string} string "Internal server error"
// @Router /api/register [post]
func (gs *GState) Register(c *fiber.Ctx) error {
u := new(types.User)
if err := c.BodyParser(u); err != nil {