-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
53 lines (41 loc) · 1.56 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"strconv"
"dt-services/config"
"dt-services/services"
"dt-services/stores"
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
)
func main() {
config.InitConf()
stores.InitDbs()
e := echo.New()
e.Use(middleware.CORS())
e.Use(middleware.Logger())
e.Use(middleware.Recover())
initRoutes(e)
e.Logger.Fatal(e.Start(":" + strconv.Itoa(services.PORT)))
}
func initRoutes(e *echo.Echo) {
e.GET("/health", services.HealthHandler)
e.GET("/github/orgs", services.GetGithubOrganizations)
e.GET("/github/repos", services.GetGithubRepos)
e.GET("/github/repos/:name", services.GetGithubRepoByName)
e.GET("/github/repos/:name/commits", services.GetGithubRepoCommitsByName)
e.GET("/github/repos/:name/commits/:sha", services.GetGithubRepoCommitBySha)
e.GET("/github/ingest", services.Ingest)
e.GET("/repos", services.GetReposHandler)
e.GET("/repos/:id", services.GetRepoByIdHandler)
e.GET("/repos/:id/commits", services.GetCommitsHandler)
e.GET("/repos/:id/commits/:commitId", services.GetCommitByIdHandler)
e.POST("/projects", services.PostProjectHandler)
e.POST("/projects/:id/repos", services.PostProjectReposHandler)
e.GET("/projects", services.GetProjectHandler)
e.GET("/projects/:id", services.GetProjectByIdHandler)
e.GET("/projects/:id/statss", services.GetProjectStatsByIdHandler)
e.DELETE("/projects/:id", services.DeleteProjectByIdHandler)
e.GET("/stats", services.GetStatsHandler)
e.GET("/projects/:id/stats", services.GetStatsByProjectHandler)
e.GET("/projects/:id/repos/:repoId/stats", services.GetStatsByRepoHandler)
}