yaus (Yet Another URL Shortener) is a simple URL shortener used to demonstrate some handy patterns to develop Go services.
It currently offers two endpoints:
/shorten
: to get a "shortened" hash
curl --request POST \
--url http://localhost:8080/shorten \
--header 'Content-Type: application/json' \
--data '{
"url": "http://www.google.it"
}'
{"hash":"dda15434615ed3debc02fef8bbea9236"}
/{hash}
: to get the proper redirect from the given "shortened" URL
$ curl --request GET \
--url http://localhost:8080/dda15434615ed3debc02fef8bbea9236
<a href="http://www.google.it">Temporary Redirect</a>.