-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
55 lines (41 loc) · 1.33 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
54
55
package main
import (
"github.com/gin-gonic/gin"
"github.com/Horizontal-org/tella-feedback/pkg/common/db"
"github.com/Horizontal-org/tella-feedback/pkg/common/middleware"
"github.com/Horizontal-org/tella-feedback/pkg/common/email"
"github.com/Horizontal-org/tella-feedback/pkg/opinions"
"github.com/spf13/viper"
)
// @title Tella feedback
// @version 1.0
// @description microservice for receiving feedback about tella in all platforms
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.url https://wearehorizontal.org
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host api.feedback.tella-app.org
// @schemes https
// @BasePath /
// @securityDefinitions.basic BasicAuth
// @externalDocs.description OpenAPI
// @externalDocs.url https://swagger.io/resources/open-api/
func main() {
viper.SetConfigFile("./pkg/common/envs/.env")
viper.ReadInConfig()
port := viper.Get("PORT").(string)
dbUrl := viper.Get("DB_URL").(string)
r := gin.Default()
h := db.Init(dbUrl)
m := email.Init()
r.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{
"hello": "world",
})
})
r.Use(middleware.CheckHeader())
// REGISTER ROUTES
opinions.RegisterRoutes(r, h, m)
r.Run(port)
}