Table of Contents
Update
- 
20200301
现在你可以使用 docker 运行服务。
docker run -d -p 8001:8001 --name bitly --restart always careywong/bitly:latest -token xxxxxxxxxxxxxxxxxxxxx
 
Install
安装依赖
make install
生成可执行文件,目录位于 build/ 。默认当前平台,其他平台请参照 Makefile 或执行对应 go build 命令。
make
Usage
自行获取 bitly api token。前往 Release 下载对应平台可执行文件。
./build/bitly.service -h
Usage of ./build/bitly.service:
  -cache int
      是否使用 redis 缓存
  -port int
    	服务端口 (default 8001)
  -token string
    	Bitly api token
./build/bitly.service -token xxxxxxxxxxxxxxxxxxx
建议配合 pm2 开启守护进程。
pm2 start bitly.service --watch --name bitly -- --token xxxxxxxxxxxxxxxxxxxx
API
GET /
Parameters
| Name | Type | Description | 
|---|---|---|
| longUrl | string | 长链接 | 
Response
Content-Type: application/json
Status: 200 OK 
{
    "Code":1,
    "Message":"",
    "LongUrl":"https://www.baidu.com",
    "ShortUrl":"http://bit.ly/38iQlfH"
}
Maintainers
from  https://github.com/CareyWang/bitly
No comments:
Post a Comment