URL 缩短器 API
本项目提供一个带简单 API 的 URL 缩短服务。
技术栈
- Golang
- Redis
API 文档
API 端点:
http://localhost:3000/api/v1/
API 请求体
url
- 原始 URLshort
- 自定义短 URL (可选)expiry
- 过期时间:整型 (小时)
API 响应
url
- 原始 URLshort
- 自定义短 URLexpiry
- 过期时间:整型 (小时)rate_limit
- 剩余 API 调用次数:整型rate_limit_reset
- 速率限制重置时间:整型 (分钟)
API 速率限制为每 30 分钟 10 次调用。这些值可以在
.env
文件中更改。玩得开心。
设置
-
启动容器
docker-compose up -d
-
测试 API: