All checks were successful
CI - Build and Push / Build and Push Docker Image (push) Successful in 52s
75 lines
1.6 KiB
Go
75 lines
1.6 KiB
Go
// Code generated by goctl. DO NOT EDIT.
|
|
// goctl 1.8.4
|
|
|
|
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"git.cialloo.com/CiallooWeb/Blog/app/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
)
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// Ping the server to check if it's alive
|
|
Method: http.MethodGet,
|
|
Path: "/ping",
|
|
Handler: pingHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/blog"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.SuperAdminAuthMiddleware},
|
|
[]rest.Route{
|
|
{
|
|
// Create a new blog post
|
|
Method: http.MethodPost,
|
|
Path: "/create",
|
|
Handler: CreatePostHandler(serverCtx),
|
|
},
|
|
{
|
|
// Delete a blog post
|
|
Method: http.MethodPost,
|
|
Path: "/delete",
|
|
Handler: DeletePostHandler(serverCtx),
|
|
},
|
|
{
|
|
// Edit an existing blog post
|
|
Method: http.MethodPost,
|
|
Path: "/edit",
|
|
Handler: EditPostHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/blog/post"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.SuperAdminAuthMiddleware},
|
|
[]rest.Route{
|
|
{
|
|
// Get presigned URL for file download
|
|
Method: http.MethodPost,
|
|
Path: "/file/download",
|
|
Handler: DownloadPresignedURLHandler(serverCtx),
|
|
},
|
|
{
|
|
// Get presigned URL for file upload
|
|
Method: http.MethodPost,
|
|
Path: "/file/upload",
|
|
Handler: UploadPresignedURLHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/blog"),
|
|
)
|
|
}
|