Short link generation service by golang
go build .
If you do not enable go modules, run export GO111MODULE=on
, then run go build .
If you are in China, you can use a proxy download package, run export GOPROXY=https://goproxy.cn
./ShortLink
- POST /api/shorten
- GET /api/info?shortlink=shortlink
- GET /:shortlink return 302 code
Use redis as the storage backend by default
If you want to replace other storage backends (e.g. mysql), you can implement the method of the Storage interface, similar to redis
There are some default environment variables
- APP_REDIS_ADDR (default "localhost:6379")
- APP_REDIS_PASSWD (default "")
- APP_REDIS_DB (default "0")
Learn from Jacky_1024