chore: add docs to swagger and add pass handlers
All checks were successful
Backend ci / build (push) Successful in 7m15s
All checks were successful
Backend ci / build (push) Successful in 7m15s
This commit is contained in:
@@ -7,6 +7,62 @@ import (
|
||||
|
||||
var log = logger.New(false)
|
||||
|
||||
// GetPosts godoc
|
||||
// @Summary Get all posts
|
||||
// @Description Get all posts
|
||||
// @Tags posts
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} []storage.Post
|
||||
// @Router /api/v1/posts [get]
|
||||
func GetPosts(c *gin.Context) {
|
||||
log.Info("GetPosts")
|
||||
}
|
||||
|
||||
// GetPost godoc
|
||||
// @Summary Get post by id
|
||||
// @Description Get post by id
|
||||
// @Tags posts
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} storage.Post
|
||||
// @Router /api/v1/posts/{id} [get]
|
||||
func GetPost(c *gin.Context) {
|
||||
log.Info("GetPost")
|
||||
}
|
||||
|
||||
// CreatePost godoc
|
||||
// @Summary Create post
|
||||
// @Description Create post
|
||||
// @Tags posts
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} storage.Post
|
||||
// @Router /api/v1/posts [post]
|
||||
func CreatePost(c *gin.Context) {
|
||||
log.Info("CreatePost")
|
||||
}
|
||||
|
||||
// UpdatePost godoc
|
||||
// @Summary Update post
|
||||
// @Description Update post
|
||||
// @Tags posts
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} storage.Post
|
||||
// @Router /api/v1/posts/{id} [put]
|
||||
func UpdatePost(c *gin.Context) {
|
||||
log.Info("UpdatePost")
|
||||
}
|
||||
|
||||
// DeletePost godoc
|
||||
// @Summary Delete post
|
||||
// @Description Delete post
|
||||
// @Tags posts
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} storage.Post
|
||||
// @Router /api/v1/posts/{id} [delete]
|
||||
func DeletePost(c *gin.Context) {
|
||||
log.Info("DeletePost")
|
||||
}
|
||||
|
||||
17
backend/internal/handlers/registry_handlers.go
Normal file
17
backend/internal/handlers/registry_handlers.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Register(router *gin.Engine) {
|
||||
v1 := router.Group("api/v1")
|
||||
posts := v1.Group("posts")
|
||||
{
|
||||
posts.GET("/", GetPosts)
|
||||
posts.GET("/:id", GetPost)
|
||||
posts.POST("/", CreatePost)
|
||||
posts.PUT("/:id", UpdatePost)
|
||||
posts.DELETE("/:id", DeletePost)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user