go-shortenurl
is a url shorten service,based on a free course of mooc - Go开发短地址服务 .
go-shortenurl requires the Go version with Module support.
git clone https://github.com/donng/go-shortenurl.git
cd go-shortenurl
go mod download
there are three simple apis
- shorten url
- get shorten url info
- visit short url and redirect
API:/api/shorten
METHOD:POST
PARAMS: { "url": "https:www.example.com", "expire_in_minutes": 60 }
API: /api/info/{link}
METHOD: GET
visit link will return status code 307 and redirect to the origin url
API: /{link}
METHOD: GET