A URL Shortner service written in Go. It accepts a URL as a POST Parameter and returns a shortened URL.
N.B
docker and git needs to be present on the system.
You may either pull the image from the Docker Hub using the following command.
$ docker pull neogopher/url-shortner
Or you may build it yourself by cloning this repo and then building the image from the supplied Dockerfile.
$ git clone https://github.com/NeoGopher/url-shortner.git
$ cd url-shortner/
$ docker build -t neogopher/url-shortner:latest
You can run the container using the below command.
$ docker run -d -p 8080:8080 neogopher/url-shortner:latest
$ curl -X POST -d '{"url": "https://docs.docker.com/engine/reference/builder/"}' http://localhost:8080/shorten
The endpoint accepts valid JSON and responds with valid JSON.
Please provide your URL as parameter "url" in Request Body.
{
"url": "https://docs.docker.com/engine/reference/builder/"
}
- url (String) : URL to be shortened
Status Code : 200
{
"data": {
"shortUrl": "http://localhost:8080/07bf7aef"
},
"message": "shortened URL generated",
"status":200
}