mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-05 16:56:22 +00:00
⚡ add middleware for authentication and captcha, implement initial API routes for user, post, label, and page
This commit is contained in:
22
internal/router/apiv1/post.go
Normal file
22
internal/router/apiv1/post.go
Normal file
@ -0,0 +1,22 @@
|
||||
package apiv1
|
||||
|
||||
import (
|
||||
"github.com/cloudwego/hertz/pkg/route"
|
||||
v1 "github.com/snowykami/neo-blog/internal/controller/v1"
|
||||
"github.com/snowykami/neo-blog/internal/middleware"
|
||||
)
|
||||
|
||||
// post 文章API路由
|
||||
|
||||
func registerPostRoutes(group *route.RouterGroup) {
|
||||
postGroup := group.Group("/post").Use(middleware.UseAuth())
|
||||
postGroupWithoutAuth := group.Group("/post")
|
||||
{
|
||||
postGroupWithoutAuth.GET("/p/:id", v1.Post.Get)
|
||||
postGroupWithoutAuth.GET("/list", v1.Post.List)
|
||||
|
||||
postGroup.POST("/p", v1.Post.Create)
|
||||
postGroup.PUT("/p", v1.Post.Update)
|
||||
postGroup.DELETE("/p", v1.Post.Delete)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user