Skip to content

pippolo84/yaus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yaus

Go Report Card Go Reference


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:

  1. /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"}
  1. /{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>.