https://github.com/yakumioto/alkaid
https://github.com/yakumioto/alkaid
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/yakumioto/alkaid
- Owner: yakumioto
- Created: 2025-04-30T02:18:59.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2025-04-30T02:42:07.000Z (about 2 months ago)
- Last Synced: 2025-04-30T03:33:03.203Z (about 2 months ago)
- Language: Go
- Size: 11.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-hacking-lists - yakumioto/alkaid - Alkaid is a BaaS(Blockchan as a Service) service based on Hyperledger Fabric. (Go)
README
# Alkaid
Alkaid 是一个基于 Gin 框架实现的轻量级 RESTful API 服务框架,专注于简单、灵活和高效的 API 开发。
## 主要特性
- **基于 Gin**: 底层使用 Gin Web 框架,保持高性能和灵活性
- **API 版本控制**: 支持通过 URL 前缀和请求头进行 API 版本管理
- **服务组织**: 简单直观的服务和控制器注册机制
- **认证机制**: 可自定义的认证系统接口,支持多种认证策略
- **中间件支持**: 支持自定义中间件处理流程
- **响应渲染**: 根据请求 Accept 头自动选择合适的响应格式(JSON、XML、YAML等)## 快速开始
```go
package mainimport (
"net/http""github.com/gin-gonic/gin"
"github.com/yakumioto/alkaid"
)func main() {
// 创建 Alkaid 实例
alk := alkaid.NewAlkaid(
alkaid.WithEngineMode(gin.DebugMode),
alkaid.WithEnableUrlVersionPrefix(),
alkaid.WithVersionHeader("X-Version"),
)// 注册服务和控制器
alk.RegisterService(&alkaid.Service{
Name: "users",
Controllers: []alkaid.Controller{
&UserController{},
},
})// 启动服务器
alk.Run(":8080")
}
```## 社区交流
QQ:567880968
Telegram: