It is a URL shortener written in golang. Shorten URLs, manage your links!
A URL shortener is a simple tool that takes a long URL and turns it into a shorter URL for you. As social media emerged, lengthy URLs started to present a problem. Originally, Twitter limited their messages to a maximum of 140 characters, and they counted every character in a link. This meant that a lengthy URL could take up your entire tweet. URL shortener tools emerged as a solution to this sharing problem. An URL shortener ensures that you get the right messages out to your audience without taking up too much space in your social posts.
To start using the project you need to install Golang (I tried it for Go 1.19).
- Run these commands:
git clone https://github.com/kitarp29/urlShortner.git
cd Infra
- Make sure you have Golang installed on your system.
go --version
- Now, we install the pkgs
go mod tidy
- Finally run the server using:
go run main.go
API will be running at localohost:8000 now.
Ensure you have docker installed in your system
- Make sure you are inside the folder of the project.
- Run this command to build the Docker Image:
docker build . -t urlshort
- You can check the image by running this:
docker images | grep urlshort
- Run a container using this:
docker run -p 8000:8000 urlshort:latest
API will be running at localohost:8000 now.
Refer PostMan Collection: Here