-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (32 loc) · 896 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
37
38
39
package main
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/hielkefellinger/go-dnd/app/initializers"
"github.com/hielkefellinger/go-dnd/app/routes"
"log"
"os"
)
var engine *gin.Engine
func init() {
log.Println("INIT: Starting Initialisation of GO-DND")
initializers.LoadEnvVariables()
initializers.LoadDatabase()
initializers.SyncDB()
log.Println("INIT: Done. Initialisation Finished")
}
func main() {
loadGinEngine()
// Serve Content
log.Println("MAIN: Starting Gin.Engine")
log.Fatal(engine.Run(fmt.Sprintf("%s:%s", os.Getenv("HOST"), os.Getenv("PORT"))))
}
func loadGinEngine() {
log.Println("MAIN: Creation of Gin.Engine")
engine = gin.Default()
// Load Routes and (static) content
log.Println("MAIN: Loading (Static) Content, Templates and Routes")
routes.HandleStaticContent(engine)
routes.HandleTemplates(engine)
routes.HandleControllerRoutes(engine)
}