feat(bookmark): 实现书签和文件夹的增删改查功能

- 添加 GetFolderDefaultRoot 方法用于获取默认根文件夹
- 实现 bookmark 和 folder 的请求/模型/响应转换函数
- 完善 CreateBookmark、CreateFolder、DeleteBookmark、DeleteFolder 等接口逻辑
- 支持删除空文件夹,非空文件夹禁止删除
- 修复根文件夹创建逻辑并添加错误处理
- 删除未实现的示例路由和无用代码

build: 引入 mage 构建工具支持多平台编译

- 添加 magefile.go 实现跨平台构建脚本
- 更新 go.mod 和 go.sum 引入 github.com/magefile/mage 依赖
- 在 README 中补充 mage 使用说明和 VSCode 配置

docs: 更新 README 并添加 mage 使用示例

- 添加 govulncheck 和 mage 构建相关文档
- 补充 VSCode gopls 配置说明

ci: 更新 .gitignore 忽略 bin 目录和可执行文件

- 添加 bin/ 到忽略列表
- 统一忽略 *.exe 和 *.sqlite3 文件

refactor(main): 优化主函数启动逻辑与日志输出

- 移除示例 helloworld 路由
- 设置 gin 为 ReleaseMode 模式
- 统一服务监听地址为变量,并增加启动日志提示
```
This commit is contained in:
zzy
2025-09-21 15:45:37 +08:00
parent 7ff8591be8
commit 36b311ff86
7 changed files with 295 additions and 99 deletions

18
main.go
View File

@ -16,11 +16,8 @@ import (
//go:embed config/api.yaml dist/*
var staticFiles embed.FS
func Helloworld(g *gin.Context) {
g.JSON(http.StatusOK, "helloworld")
}
func main() {
gin.SetMode(gin.ReleaseMode)
router := gin.Default()
router.GET("/ping", func(c *gin.Context) {
@ -39,14 +36,9 @@ func main() {
api.RegisterHandlers(api_router, server)
}
eg := api_router.Group("/example")
{
eg.GET("/helloworld", Helloworld)
}
handlers.TodoHandler(api_router)
}
handlers.TodoHandler(api_router)
// FIXME 可能有更好的方式实现这个代码
// 提供嵌入的静态文件访问 - OpenAPI YAML 文件和 dist 目录
router.GET("/swagger.yaml", func(c *gin.Context) {
@ -66,5 +58,9 @@ func main() {
// 恢复原始路径
r.URL.Path = originalPath
})
log.Fatal(router.Run("127.0.0.1:8080"))
var listener = "127.0.0.1:8080"
log.Printf("Starting server at http://%s", listener)
log.Printf("Swagger UI: http://%s/swagger/index.html", listener)
log.Fatal(router.Run(listener))
}