url/internal/handler/routes.go

42 lines
841 B
Go
Raw Permalink Normal View History

2024-12-26 16:08:14 +00:00
// Code generated by goctl. DO NOT EDIT.
// goctl 1.7.3
package handler
import (
"net/http"
"time"
url "url_generate/internal/handler/url"
"url_generate/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
// Create Short URL
Method: http.MethodPost,
Path: "/",
Handler: url.CreateShortURLHandler(serverCtx),
},
{
// Retrieve Short URL
Method: http.MethodGet,
Path: "/:short_code",
Handler: url.GetOriginalURLHandler(serverCtx),
},
{
// Delete Short URL
Method: http.MethodDelete,
Path: "/:short_code",
Handler: url.DeleteShortURLHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/url"),
rest.WithTimeout(10000*time.Millisecond),
)
}