summary refs log tree commit diff stats
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/main.go b/main.go
index c98abf0..a08c858 100644
--- a/main.go
+++ b/main.go
@@ -1,17 +1,30 @@
 package main
 
 import (
+	"embed"
+	"html/template"
 	"net/http"
 
+	"github.com/ckrinitsin/go-backend/handlers"
 	"github.com/gin-gonic/gin"
 )
 
+//go:embed templates/*
+var templatesFS embed.FS
+
 func main() {
 	r := gin.Default()
-	r.GET("/ping", func(c *gin.Context) {
+
+	tmpl := template.Must(template.ParseFS(templatesFS, "templates/*"))
+	r.SetHTMLTemplate(tmpl)
+
+	r.GET("/health", func(c *gin.Context) {
 		c.JSON(http.StatusOK, gin.H{
-			"message": "pong",
+			"health-check": "passed",
 		})
 	})
-	r.Run("127.0.0.1:8081") // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
+
+	r.GET("/shopping", shopping_list.LoadElements)
+
+	r.Run()
 }