A command-line tool to shorten url and still function effectively. The main aim behind this is to get rid of extremely long URLs [Lovely right?]
This is a very simple Golang project for efficiency, Couldn't guess further more.
This simple project seems to make use of the os package. Personally,it was my first time using the net/http locally.
baseUrl := "http:https://tinyurl.com/api-create.php?url="
urlToShorten := os.Args[1]
getReqUrl := baseUrl + urlToShorten
response, err := http.Get(getReqUrl)
if err != nil {
log.Fatal(err)
}
In the terminal, there must not be less than two arguments, i.e should include program name and url to be shortened.
My URL to be shortened is: https://github.com/fiificoder/CLI-calculator/blob/master/README.md
./urlToShort www.https://github.com/fiificoder/CLI-calculator/blob/master/README.md
go run main.go https://github.com/fiificoder/CLI-calculator/blob/master/README.md