支持通过controller自动解析注册接口路由 #2

Merged
zhangdeman merged 22 commits from feature/router into master 2025-02-07 17:32:35 +08:00
Showing only changes of commit deead87688 - Show all commits

View File

@ -37,7 +37,7 @@ func init() {
// Author : go_developer@163.com<白茶清欢>
//
// Date : 21:40 2024/7/20
func Register(port int, controllerList ...any) {
func Register(port int, controllerList ...any) error {
for _, controller := range controllerList {
if nil == controller {
// 忽略空指针
@ -45,7 +45,7 @@ func Register(port int, controllerList ...any) {
}
parseController(controller)
}
ginRouter.Run(fmt.Sprintf(":%d", port))
return ginRouter.Run(fmt.Sprintf(":%d", port))
}
// parseController 解析controller