MCPcopy Index your code
hub / github.com/apache/devlake / CreateApiServer

Function CreateApiServer

backend/server/api/api.go:80–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

78}
79
80func CreateApiServer() *gin.Engine {
81 // Create router
82 router := gin.Default()
83
84 // Enable CORS
85 // cfg := basicRes.GetConfigReader()
86 // router.Use(cors.New(cors.Config{
87 // // Allow all origins
88 // AllowOrigins: cfg.GetStringSlice("CORS_ALLOW_ORIGIN"),
89 // // Allow common methods
90 // AllowMethods: []string{"PUT", "PATCH", "POST", "GET", "OPTIONS"},
91 // // Allow common headers
92 // AllowHeaders: []string{"Origin", "Content-Type"},
93 // // Expose these headers
94 // ExposeHeaders: []string{"Content-Length"},
95 // // Allow credentials
96 // AllowCredentials: false,
97 // // Cache for 2 hours
98 // MaxAge: 120 * time.Hour,
99 // }))
100
101 // For both protected and unprotected routes
102 router.GET("/ping", ping.Get)
103 router.GET("/ready", ping.Ready)
104 router.GET("/health", ping.Health)
105 router.GET("/version", version.Get)
106
107 // Api keys
108 router.Use(RestAuthentication(router, basicRes))
109 router.Use(OAuth2ProxyAuthentication(basicRes))
110
111 return router
112}
113
114func SetupApiServer(router *gin.Engine) {
115 // Set gin mode

Callers 1

CreateAndRunApiServerFunction · 0.85

Calls 2

RestAuthenticationFunction · 0.85

Tested by

no test coverage detected