This commit is contained in:
2026-07-03 16:08:13 +08:00
parent 4fdd97a5c7
commit 5e2ec4c14c
+5
View File
@@ -20,6 +20,11 @@ func init() {
}
Httpserver.SetOpenApiPath("/api.json")
Httpserver.BindMiddlewareDefault(ghttp.MiddlewareHandlerResponse)
// CORS - allow all origins
Httpserver.BindMiddlewareDefault(func(r *ghttp.Request) {
r.Response.CORS(r.Response.DefaultCORSOptions())
r.Middleware.Next()
})
}
// RouteRegister 根据控制器结构体名称自动注册路由