Changed shortener endpoint to /api/v1/links
This commit is contained in:
@@ -32,5 +32,5 @@ service fivefeeteleven-api {
|
|||||||
get /:id(ExpandReq) returns(ExpandResp)
|
get /:id(ExpandReq) returns(ExpandResp)
|
||||||
|
|
||||||
@handler ShortenUrl
|
@handler ShortenUrl
|
||||||
post /redirect(ShortenReq) returns(ShortenResp)
|
post /api/v1/links(ShortenReq) returns(ShortenResp)
|
||||||
}
|
}
|
||||||
@@ -7,8 +7,8 @@ A URL shortener that generates links even shorter than 5'11.
|
|||||||
# Shorten a URL
|
# Shorten a URL
|
||||||
curl --header "Content-Type: application/json" \
|
curl --header "Content-Type: application/json" \
|
||||||
--request POST \
|
--request POST \
|
||||||
--data '{"redirectUrl":"https://news.ycombinator.com"}' \
|
--data '{"longUrl":"https://news.ycombinator.com"}' \
|
||||||
http://localhost:5111/redirect
|
http://localhost:5111/api/v1/links
|
||||||
|
|
||||||
# Expand the URL
|
# Expand the URL
|
||||||
curl -iL http://localhost:5111/{id}
|
curl -iL http://localhost:5111/{id}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Method: http.MethodPost,
|
Method: http.MethodPost,
|
||||||
Path: "/redirect",
|
Path: "/api/v1/links",
|
||||||
Handler: ShortenUrlHandler(serverCtx),
|
Handler: ShortenUrlHandler(serverCtx),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user