Skip to content

Latest commit

 

History

History
23 lines (23 loc) · 935 Bytes

README.md

File metadata and controls

23 lines (23 loc) · 935 Bytes

ShortLink

Short link generation service by golang

Install

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

Usage

./ShortLink

API

  • POST /api/shorten
  • GET /api/info?shortlink=shortlink
  • GET /:shortlink return 302 code

Note

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")

Thank

Learn from Jacky_1024

License