Coder Social home page Coder Social logo

bitly's Introduction

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

bitly's People

Contributors

careywang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.