A simple link shortener written in GO
- Makes links shorter
Follow these steps to set up the project locally.
-
Clone the repository:
git clone https://github.com/tsugent/link_shortener_go.git
-
Navigate to directory:
cd ./link_shortener_go/
-
Build/Run Production:
go build -o go-url-short . ./go-url-short
Development:
go run .
-
Create a Shortened Link:
#POST:
curl -X POST localhost:8080/shorten -d '{"originalURL": "https://facebook.com", "created": "10/19/2021 10:19:01"}'
#STDOUT:
"{\"shortened_link\": \"http://localhost:8080/short/?r=e70f7e67\"}"
-
Retrieve URL to be directed to:
#GET:
curl -X GET "http://localhost:8080/short/?r=e70f7e67"
#STDOUT:
"{\"original_url\": \"https://facebook.com\"}"
I don't know why you'd do something like that.