first prototype

This commit is contained in:
2025-12-01 08:38:21 +00:00
parent e07d34d626
commit 1e5fd35659
14 changed files with 2431 additions and 1 deletions

36
main.go Normal file
View File

@@ -0,0 +1,36 @@
package main
import (
"log"
"net/http"
"github.com/b2dennis/meshi/csv"
"github.com/b2dennis/meshi/gintemplrenderer"
"github.com/b2dennis/meshi/ui/pages"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
ginHtmlRenderer := r.HTMLRender
r.HTMLRender = &gintemplrenderer.HTMLTemplRenderer{FallbackHtmlRenderer: ginHtmlRenderer}
r.SetTrustedProxies(nil)
r.GET("", getMenu)
r.Static("/assets", "./assets")
if err := r.Run(); err != nil {
log.Fatalf("failed to run server: %v", err)
}
}
func getMenu(c *gin.Context) {
plan, err := csv.Load()
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "couldn't load menu csv"})
return
}
c.HTML(http.StatusOK, "", pages.Home(plan))
}