-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
36 lines (28 loc) · 672 Bytes
/
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
package main
import (
"fmt"
"log"
"net/http"
"github.com/gin-gonic/gin"
"github.com/shubham9411/kumaoni-backend/config"
"github.com/shubham9411/kumaoni-backend/models"
"github.com/shubham9411/kumaoni-backend/routes"
"github.com/shubham9411/kumaoni-backend/utils"
)
func main() {
fmt.Println("Welcome to Kumaoni API")
db := config.Connect()
models.SetDatabase(db)
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "pong",
})
})
routes.InitializeRoutes(r)
port := utils.GodotEnv("GO_PORT")
err := r.Run(fmt.Sprintf(":%s", port))
if err != nil {
log.Fatal("Something went wrong:: ", err)
}
}