• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

alimitedgroup / MVP / 13785092874

11 Mar 2025 09:52AM UTC coverage: 34.463% (+27.7%) from 6.719%
13785092874

Pull #16

github

web-flow
Merge cd7bbf9ec into c70df8f01
Pull Request #16: Codifica iniziale del servizio `api-gateway`

131 of 307 new or added lines in 11 files covered. (42.67%)

10 existing lines in 1 file now uncovered.

183 of 531 relevant lines covered (34.46%)

1.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/srv/api_gateway/controller/controller.module.go
1
package controller
2

3
import (
4
        "github.com/gin-gonic/gin"
5
        "go.uber.org/fx"
6
)
7

8
var Module = fx.Options(
9
        fx.Provide(NewHTTPHandler),
10
        fx.Provide(AsController(NewHealthCheckController)),
11
        fx.Provide(AsController(NewLoginController)),
12
        fx.Provide(AsController(NewAuthHealthCheckController)),
13
        fx.Invoke(fx.Annotate(RegisterRoutes, fx.ParamTags("", `group:"routes"`))),
14
)
15

NEW
16
func RegisterRoutes(http *HTTPHandler, controllers []Controller) {
×
NEW
17
        for _, controller := range controllers {
×
NEW
18
                var group *gin.RouterGroup
×
NEW
19
                if controller.RequiresAuth() {
×
NEW
20
                        group = http.AuthenticatedGroup
×
NEW
21
                } else {
×
NEW
22
                        group = http.ApiGroup
×
NEW
23
                }
×
NEW
24
                group.Handle(controller.Method(), controller.Pattern(), controller.Handler())
×
25
        }
26
}
27

28
type Controller interface {
29
        Handler() gin.HandlerFunc
30
        Pattern() string
31
        Method() string
32
        RequiresAuth() bool
33
}
34

NEW
35
func AsController(f any) any {
×
NEW
36
        return fx.Annotate(
×
NEW
37
                f,
×
NEW
38
                fx.As(new(Controller)),
×
NEW
39
                fx.ResultTags(`group:"routes"`),
×
NEW
40
        )
×
NEW
41
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc