- Golang
- Docker
- Docker Hub Account
make test
make run
-
Run the following command to build the Docker image:
make docker-build
-
Run the following command to start the Docker container:
make docker-run
curl --location 'localhost:3000' \
--header 'Content-Type: application/json' \
--data '{
"longURL": "https://github.com/sagar-jadhav"
}'
You should get the response in the below format. Data might vary as the short URL is generated randomly. But once you generated the Short URL you will get the same response till the application is running.
{
"longURL": "https://github.com/sagar-jadhav",
"shortURL": "http://localhost:3000/qIFxf"
}
curl --location 'http://localhost:3000/metrics'
[
{
"domain": "github.com",
"count": 1
}
]
Note:
I have already pushed the image to DockerHub So If you want to run the application without building it then run the following command:
docker run -d -p 3000:3000 --name url-shortener developersthought/url-shortener:1.0