From 6603399d96db457d3f7ce4781c72c0a9b873cca7 Mon Sep 17 00:00:00 2001 From: Alex Myasoedov Date: Mon, 29 Feb 2016 21:42:00 +0200 Subject: [PATCH] First working version --- main.go | 16 +++------------- templates/index.html | 30 ------------------------------ templates/index.tmpl | 3 +-- 3 files changed, 4 insertions(+), 45 deletions(-) delete mode 100644 templates/index.html diff --git a/main.go b/main.go index 5d8af2c..d4d38c5 100644 --- a/main.go +++ b/main.go @@ -11,10 +11,11 @@ func NewApp() *gin.Engine { r := gin.Default() - r.LoadHTMLGlob("templates/*.tmpl") + r.LoadHTMLGlob("templates/index.tmpl") + r.Static("/static", "./static") r.GET("/", func(c *gin.Context) { - c.HTML(200, "index.tmpl", gin.H{ + c.HTML(200, "users/index.tmpl", gin.H{ "pubTo": "Users", }) }) @@ -31,17 +32,6 @@ func NewApp() *gin.Engine { c.String(403, "") }) - // Get user value - r.GET("/user/:name", func(c *gin.Context) { - user := c.Params.ByName("name") - value, ok := DB[user] - if ok { - c.JSON(200, gin.H{"user": user, "value": value}) - } else { - c.JSON(200, gin.H{"user": user, "status": "no value"}) - } - }) - return r } diff --git a/templates/index.html b/templates/index.html deleted file mode 100644 index 13e340d..0000000 --- a/templates/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - Hacker Slides - - - - - -
- -
-
- -
- -
- - - - - - - - diff --git a/templates/index.tmpl b/templates/index.tmpl index c9c3948..b3c2d48 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -14,11 +14,10 @@
-