bitly

command module
v0.0.0-...-977ab9e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2020 License: MIT Imports: 10 Imported by: 0

README

bitly

基于 golang1.13 与 bitly api 实现的短链接生成服务

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

@CareyWang

Contributing

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © 2020 CareyWang

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL