Skip to content

Commit

Permalink
feat(controller): add delete endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Oct 3, 2020
1 parent 9e60505 commit 9ab63ed
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions controller/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@ func ListUrl(res http.ResponseWriter, req *http.Request) {

response.JSON(res, http.StatusOK, response.Body{"urls": urls})
}

func DeleteShortUrl(res http.ResponseWriter, req *http.Request) {
if err := url.DeleteUrlFromRequest(req); err != nil {
response.JSON(res, http.StatusNotFound, response.Body{"message": err.Error()})
return
}

response.JSON(res, http.StatusOK, response.Body{"deleted": true})
}

0 comments on commit 9ab63ed

Please sign in to comment.