-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain.go
More file actions
39 lines (30 loc) · 775 Bytes
/
main.go
File metadata and controls
39 lines (30 loc) · 775 Bytes
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
package main
import (
"log"
"net/http"
"github.com/bebop/ark/initializers"
"github.com/gin-gonic/gin"
)
var (
server *gin.Engine
)
func init() {
config, err := initializers.LoadConfig(".devcontainer")
if err != nil {
log.Fatal("? Could not load environment variables", err)
}
initializers.ConnectDB(&config)
server = gin.Default()
}
func main() {
config, err := initializers.LoadConfig(".devcontainer")
if err != nil {
log.Fatal("? Could not load environment variables", err)
}
router := server.Group("/api")
router.GET("/healthchecker", func(ctx *gin.Context) {
message := "Welcome to Golang with Gorm and Postgres"
ctx.JSON(http.StatusOK, gin.H{"status": "success", "message": message})
})
log.Fatal(server.Run(":" + config.ServerPort))
}