/short_url

开箱即用的短网址服务——GO语言部署版本

Primary LanguageGo

GO版本短网址服务

相关依赖

  1. 基础框架:GIN(https://github.com/gin-gonic/gin)
  2. 数据库:GORM(https://gorm.io/zh_CN/docs/)
  3. Redis:https://github.com/go-redis/redis
  4. 配置管理:https://github.com/spf13/viper
  5. 日期处理:Carbon

部署方法

  1. Clone 本项目
  2. 修改配置cp config.json.tmp config.json,完善配置
  3. 数据迁移go run main/migrate
  4. 启动服务go run main/service

使用方法

  1. 联系管理员获取Key+Secret,注意每个Key的数据相互隔离,数据存在auth数据表中
  2. 通过自定义Header传入验证参数(服务端调用,简单验证)
    1. X-Auth-Key = Key
    2. X-Auth-Secret = Secret
    3. 调用接口:POST 127.0.0.1:8090/api/url ,生成短链,访问短链即可跳转

提供的接口

详见:test目录下 short_url.http