Changed shortener endpoint to /api/v1/links

This commit is contained in:
strNophix 2022-08-28 11:45:07 +02:00
parent 4539c926ec
commit 9aee40d3b1
3 changed files with 4 additions and 4 deletions

View File

@ -32,5 +32,5 @@ service fivefeeteleven-api {
get /:id(ExpandReq) returns(ExpandResp)
@handler ShortenUrl
post /redirect(ShortenReq) returns(ShortenResp)
post /api/v1/links(ShortenReq) returns(ShortenResp)
}

View File

@ -7,8 +7,8 @@ A URL shortener that generates links even shorter than 5'11.
# Shorten a URL
curl --header "Content-Type: application/json" \
--request POST \
--data '{"redirectUrl":"https://news.ycombinator.com"}' \
http://localhost:5111/redirect
--data '{"longUrl":"https://news.ycombinator.com"}' \
http://localhost:5111/api/v1/links
# Expand the URL
curl -iL http://localhost:5111/{id}

View File

@ -19,7 +19,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
},
{
Method: http.MethodPost,
Path: "/redirect",
Path: "/api/v1/links",
Handler: ShortenUrlHandler(serverCtx),
},
},