ShortURL Service Written by GoLang
go get github.com/caoxiaolin/go-shorturl
http服务启动后 post一个url过去,返回短链接 请求短链接,返回原始的URL,链接不存在,则返回404
curl -d "url=http://www.github.com" "http://127.0.0.1:4000" http://127.0.0.1:4000/oM1F curl "http://127.0.0.1:4000/oM1F" http://www.github.com
请求不存在的短链时:
curl "http://127.0.0.1:4000/xx79y" -i HTTP/1.1 404 Not Found Date: Tue, 05 Jun 2018 10:18:12 GMT Content-Length: 0